i have added uitableview
main.storyboard
without setting additional attributes. on iphone table fills out in portrait in landscape mode, complete screen, desired behavior. however, when starting app on ipad, table looks this:
when add following constraints table view:
- leading space container margin
- trailing space container margin
- vertical spacing top layout guide
- vertical spacing bottom layout guide
the issue fixed on ipad (portrait & landscape mode), on iphone first cell in landscape mode hidden:
how can fix this? issue not occur in portrait mode on iphone, nor happen on ipad in both modes.
btw, controller attribute "adjust scroll view insets" enabled.
for inset please add below code
-(void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath{ if ([tableview respondstoselector:@selector(setseparatorinset:)]) { [tableview setseparatorinset:uiedgeinsetszero]; } if ([tableview respondstoselector:@selector(setlayoutmargins:)]) { [tableview setlayoutmargins:uiedgeinsetszero]; } if ([cell respondstoselector:@selector(setlayoutmargins:)]) { [cell setlayoutmargins:uiedgeinsetszero]; } }
for making tableview fit in devices fits in whole screen add below shown constraints.
the resulting tableview be
Comments
Post a Comment