iphone - UITableViewCell reloadcellsAtIndexPaths increases the height of the following cell but not the actual one -


[self.tableview reloadrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:0 insection:0]] withrowanimation:uitableviewrowanimationnone]; 

after increasing height of 1st cell in heightforrowatindexpath. surprise increasing height of second cell, when scroll table view... height of first 1 set desired.

if reload entire table using [tv reloaddata] works fine.. not work if particular cell

any on helpful..

as written in comments above, have vague understanding want achieve. assume want extend cell changing height. mention first cell, guess, want able, cell when being clicked.

the complete project available @ github

.h

#import <uikit/uikit.h>   @interface firstviewcontroller : uitableviewcontroller <uitableviewdelegate, uitableviewdatasource> {     nsindexpath *selectedindexpath;     nsdictionary *articles; }  @end 

.m

#import "firstviewcontroller.h" @implementation firstviewcontroller - (void)viewdidload {     [super viewdidload];     selectedindexpath = nil;     articles = [[nsdictionary dictionarywithobject:[nsarray arraywithobjects:@"one", @"two", @"three",                                                     @"four", @"five", @"six",                                                     @"seven", @"eight", @"nine",                                                     @"ten", @"eleven", nil]                  forkey:@"title"] retain]; } - (void)didreceivememorywarning {     [super didreceivememorywarning]; }  - (void)viewdidunload {  }  - (void)dealloc {     [selectedindexpath release];     [articles release];     [super dealloc]; }  - (int)numberofsectionsintableview:(uitableview *)tableview {     return [[articles allkeys] count]; }  - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {     return [[articles allkeys] objectatindex : section]; }  - (int)tableview:(uitableview *)table numberofrowsinsection:(nsinteger)section {     id key = [[articles allkeys] objectatindex:section];     return [[articles objectforkey : key] count]; }  - (float)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     if ((selectedindexpath != nil) && (selectedindexpath.row == indexpath.row))         return 80.0;     return 40.0; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring * myidentifier = @"myidentifier";     uitableviewcell * cell = [self.tableview dequeuereusablecellwithidentifier:myidentifier];     if (cell == nil) {         cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:myidentifier] autorelease];     }     id key = [[articles allkeys] objectatindex:indexpath.section];     cell.textlabel.text = [[articles objectforkey:key] objectatindex:indexpath.row];     return cell; }  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     if (selectedindexpath == indexpath) {         selectedindexpath = nil;     } else {         selectedindexpath = indexpath;     }     [self.tableview deselectrowatindexpath : indexpath animated : no];     [tableview beginupdates];     [tableview endupdates]; }  @end 

this code quite rough, extracted project in iphone-days. i.e. properties missing.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -