ios - How can i use custom UITableViewCell and UITableView in same xib -


i want use custom uitableviewcell uitableview in same xib without creating uitableviewcell class?

as can see bellow set identifier uitableviewcell , used this:

uitableview , uitableviewcell in same xib

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath   {     static nsstring *cellidentifier = @"customidentifier";      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];   }  } 

but not working?

add uitableviewcell *customcell property view controller (for example, file showusers.h)...

@property (nonatomic, strong) iboutlet uitableviewcell *customcell; 

and connect custom cell in xib. use following code in cellforrow (for example, file showusers.m) :

if (cell == nil) {     [[nsbundle mainbundle] loadnibnamed:@"nibname" owner:self options:nil];     cell = self.customcell;     self.customcell = nil; } 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -