ios - UITableView cell having different identifiers for three different cell design -


- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @"reviews";     static nsstring *cellidentifier1 = @"recipes";        static nsstring *cellidentifier2 = @"easy_tips";     // configure cell      nsstring *type = [[myaray objectatindex:indexpath.row]objectforkey:@"type"];     nslog(@"types====%@",type);      uitableviewcell *mycell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];      if (type == cellidentifier) {      firstcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];          nslog(@"first type %@", type);      return cell;     }else if (type == cellidentifier1){       secondtableviewcell *cell1 =  [tableview dequeuereusablecellwithidentifier:cellidentifier1 forindexpath:indexpath];           return cell1;      }else if (type == cellidentifier2){      thirdtableviewcell *cell2 =  [tableview dequeuereusablecellwithidentifier:cellidentifier2 forindexpath:indexpath];          return cell2;     }      return mycell; } 

i getting 1 cell every time first cell .

it not going if condition statement. in advance reply

change every part use == compare string isequaltostring:

for example: change

if (type == cellidentifier) 

to

if([type isequaltostring:cellidentifier]) 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -