ios - Cell is not hiding properly on iPad? -
i want hide/remove row when condition met.
i made research , found can returning 0 cell height.
this works great on iphone, not ipad.
please advice.
here screenshot of issue:
when not hidden looks this:
my code:
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if ([indexpath section]==2 && [indexpath row]==0 && [self hasnocontact]) { return 0; } return 44; }
hasnocontact
bool use determine if should hidden.
do @stonz suggested in comment, return empty cell.
it requires me implement method , return each possible cell on tableview. wish there easier way
well, mention static, dont have return each possible cell, can super
.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if ([indexpath section]==2 && [indexpath row]==0 && [self hasnocontact]) { return [[uitableviewcell alloc]init]; } return [super tableview:tableview cellforrowatindexpath:indexpath]; }
Comments
Post a Comment