ios - heightForRowAtIndexPath setting height for wrong row -
i have weird problem heightforrowatindexpath
function. need height 3rd row higher, sets height next (in case 4the) row.
i'll explain:
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { int height = 40; if(indexpath.row == 3) height = 120; nslog(@"cell %i [height = %i]", indexpath.row, height); return height; }
it logs this: (seems good)
cell 0 [height = 40] cell 1 [height = 40] cell 2 [height = 40] cell 3 [height = 120] cell 4 [height = 40] cell 5 [height = 40] ...
and looks this:
** (to clear: gray row not section different cell style.)
am missing badly or wrong? thanks!
as requested, added cellforrowatindexpath code.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"frontendcell"; int celltype = [[self.celltypes objectatindex:indexpath.row] integervalue]; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; switch (celltype) { case frontend_cell_type_detail:{ cell = [[frontenddetailtableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; cell.title.text = [self.titles objectatindex:indexpath.row]; cell.description.text = [self.descriptions objectatindex:indexpath.row]; cell.price.text = [self.details objectatindex:indexpath.row]; cell.price.text = [self.details objectatindex:indexpath.row]; }break; }
maybe, works fine not presented expect.
i mean height set 120 row3 design shifted looks next cell has 120 height. please try select cells, maybe selection background informative. try play cell design clarify that
Comments
Post a Comment