ios - UITableViewCell not Display Subtitle when i am set the initwithstyle:UItableviewsubtitle -


- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nsstring *cellidenti = @"cell";     uitableviewcell *cell = [tableview dequeuereusableheaderfooterviewwithidentifier:cellidenti];      if(cell == nil)     {         cell= [[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidenti];     }     cell.textlabel.text = isactive?searchdata[indexpath.row]:tabledata[indexpath.row];     cell.detailtextlabel.text = isactive?searchnumberdata[indexpath.row]:tablenumberdata[indexpath.row];        return cell; } 

i not getting perfect view , not using storyboard.

two things have observed in code

1) use correct way of cell reusability using dequeuereusablecellwithidentifier (as others suggested). have @ way of reusability of cell here using dequeuereusablecellwithidentifier:forindexpath:.

2) try use nil instead of nil. have @ this thread.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nsstring *cellidenti = @"cell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidenti];      if(cell == nil)     {         cell= [[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidenti];     }     cell.textlabel.text = isactive?searchdata[indexpath.row]:tabledata[indexpath.row];     cell.detailtextlabel.text = isactive?searchnumberdata[indexpath.row]:tablenumberdata[indexpath.row];        return cell; } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -