ios - XCode 6 issue - dequeueReusableCellWithIdentifier not returning custom cell height -


i have uitableviewcontroller 2 prototype cells custom heights - 1 has height of 187 points , other has height of 140 points. tableview's default row height ser 187.

my cellforrowatindexpath looks this:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath  {     if (indexpath.section == 0) {         mylistingcell *cell = [tableview dequeuereusablecellwithidentifier:@"mylistingcell"];         [cell initwithlisting:[self.listings objectatindex:indexpath.row]];         return cell;     } else {         return [tableview dequeuereusablecellwithidentifier:@"addmylistingcell"];     } } 

and have matching heightforrowatindexpath looks this:

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath  {     if (indexpath.section == 0) {         uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"mylistingcell"];         return cell.frame.size.height;     } else {          //if no listings exist, make cell full-screen height         if (self.listings.count == 0) {                return tableview.frame.size.height;         } else {             uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"addmylistingcell"];             return cell.frame.size.height;         }     } } 

when run code, cell heights come out correctly. 187 , 140 respectively.

however, change size of larger cell 213 points. change custom tablecell height 213. problem when run code (using xcode 6) table cells still come out height 187.

i tried changing default tableview rowheight property, 213. still 187. in fact, when @ storyboard (as text) there no mention of 187 anywhere. seems xcode remembering previous value.

i have tried cleaning, deep cleaning, restarting xcode, deleteing app phone, , deleting debug products. can't forget 187.

could bug in xcode 6? in xcode 5 not happen (proven). custom cell heights have been working fine in xcode 5 problem has arisen day after install xcode 6.

can advice on things try, or confirmation i'm not going crazy.

heightforrowatindexpath called before cellforrowatindexpath, can never use try reference cell , height. @ following code following log lines , result:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     nslog(@"cell");     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];      if (!cell) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"];     }      return cell; }  - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     nslog(@"height");     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];     nslog(@"%@", cell);     return cell.frame.size.height; } 

that results in:

2014-09-23 09:55:05.114 newtesting[54040:60b] height 2014-09-23 09:55:05.114 newtesting[54040:60b] (null) 2014-09-23 09:55:05.115 newtesting[54040:60b] height 2014-09-23 09:55:05.115 newtesting[54040:60b] (null) 2014-09-23 09:55:05.115 newtesting[54040:60b] height 2014-09-23 09:55:05.116 newtesting[54040:60b] (null) 2014-09-23 09:55:05.116 newtesting[54040:60b] height 2014-09-23 09:55:05.116 newtesting[54040:60b] (null) 2014-09-23 09:55:05.117 newtesting[54040:60b] cell 2014-09-23 09:55:05.118 newtesting[54040:60b] cell 2014-09-23 09:55:05.119 newtesting[54040:60b] cell 2014-09-23 09:55:05.120 newtesting[54040:60b] cell 

with in mind method you're using never work.

have tried more simple, following (although use constants)

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     return indexpath.section == 0 ? 213 : 140; } 

that assuming cells in first section 213 tall , other section 140 tall, may incorrect.

ultimately, think best way want ask data source type of cell should exist @ given indexpath, , therefore how tall cell should be.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -