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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -