animation - ios - Expand table view cell like Twitter app -
animation - ios - Expand table view cell like Twitter app -
i want have same behavior twitter app when selecting tweet : expanding row , adding supplementary content.
so not basic row resize. think need 2 different custom cells, did :
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if ([indexpath compare:self.selectedindexpath] != nsorderedsame) { firstcell *cell = [tableview dequeuereusablecellwithidentifier:@"firstcell"]; if (!cell) { cell = [[firstcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"firstcell"]; } cell.firstnamelabel.text = [[self.items objectatindex:indexpath.row] objectforkey:@"firstname"]; homecoming cell; } else { secondcell *cell = [tableview dequeuereusablecellwithidentifier:@"secondcell"]; if (!cell) { cell = [[secondcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"secondcell"]; } cell.firstnamelabel.text = [[self.items objectatindex:indexpath.row] objectforkey:@"firstname"]; cell.lastnamelabel.text = [[self.items objectatindex:indexpath.row] objectforkey:@"lastname"]; homecoming cell; } } - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if ([indexpath compare:self.selectedindexpath] == nsorderedsame) { homecoming 80.0; } else { homecoming 44.0; } } #pragma mark - table view delegate - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { self.selectedindexpath = indexpath; [tableview reloaddata]; }
my problem here want maintain fluid animation twitter app not case because of [tableview reloaddata]
(which mandatory think since have 2 different custom cell).
so knows workaround needed or maybe knows how twitter app handling animation stuff ?
you want reload cell animation:
[tableview beginupdates]; [tableview reloadrowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; [tableview endupdates];
ios animation twitter uitableview
Comments
Post a Comment