简体   繁体   中英

tableview partially hidden first time loaded with iOS7 SDK

this issue is similar with the navigation-bar-appear-over-the-views-with-new-ios7-sdk ,but there is a subtle difference.The solution is below:

    if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;

it did work for me if the tableView is embedded on navigationController,BUT if the tableView is not under this navigationController hierarchy(for instance, a tableView is embedded on a controller,this controller is the subView of another controller which is based on navigationController),this solution failed.

So I'm puzzled how to fix this issue.It would be a great help to me if you could lend me a hand.Thanks.

I believe you need to move these lines to the controller directly under UINavigationController .

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;

EDIT: As a hack, you can set your table top position manually as below.

CGFloat tableTop = 44.0f; //iOS7
if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] == NSOrderedAscending) {
    tableTop = 44; //iOS6
}

CGRect frame = self.tableView.frame;
self.tableView.frame = CGRectMake(frame.origin.x, tableTop, frame.size.width, frame.size.height);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM