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:

enter image description here

when not hidden looks this:

enter image description here

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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -