1

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.

Community
  • 1
  • 1
piaChai
  • 1,551
  • 2
  • 15
  • 18

1 Answers1

0

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);
Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
  • If you are using storyboards, you can add a constraint to Top Layout Guide as shown in this post: http://stackoverflow.com/questions/18902963/ios-7-status-bar-translucency-with-backwards-compatability/19017553#19017553 – Yas Tabasam Feb 24 '14 at 05:57
  • pathetically I'm not using storyboards...all by codes. – piaChai Feb 24 '14 at 08:04
  • Maybe it's the best solution for my situation,it did work fine,thanks – piaChai Feb 25 '14 at 02:23