0

I have a UITableView that when first displayed it displays correctly with the first row appearing on top. When I select a cell another UITableView is presented. If I used the back button on the UINavigation Bar the original UITableView is shifted down with a blank space between the UINavigation Bar and the UITableView.

I am not using story boards. I am using XIB files. I am also using a sliding menu that I got the code for from Ray Wenderlich's web site.

When I slide back the main screen over the first UITableView it goes back to its proper position. But then when I select an entry again the issue described above appears.

I found another post that seems to provide an answer to the issue. This post says to make some adjustments like to the translucent settings or the auto-layout settings but doesn't give specifics.

Here is that post: Container View getting pushed down as if it had a UINavigationBar?

Thanks, Glenn

Community
  • 1
  • 1
glennsep
  • 164
  • 3
  • 10
  • Did you try setting `self.automaticallyAdjustsScrollViewInsets = NO;` – UditS Jan 28 '16 at 07:31
  • Hi UditS, I tried adding this to the viewdidload and viewdidappear methods. It didn't work. The issue is the UITableView shifts down leaving a blank space between the navigation bar on top and the table view. Where should this code go? Thanks, Glenn – glennsep Jan 30 '16 at 03:24
  • This should go in `viewDidLoad`. If it doesn't work, you can also try other things such as Translucent property of `UINavigationBar` `self.navigationController.navigationBar.translucent = NO;` or turning off extended edges below top bar `self.edgesForExtendedLayout = UIRectEdgeNone;` – UditS Jan 30 '16 at 06:59
  • Hi UditS, that did the trick! I was putting the statement "self.automaticallyAdjustsScrollViewInsets = NO;" in the viewdidload method, but in the wrong view controller. When I placed it in the view controller that was at the beginning of the stack it worked. Thank you! Glenn – glennsep Jan 31 '16 at 17:41

1 Answers1

0

Add

self.automaticallyAdjustsScrollViewInsets = NO;

in viewDidLoad, of the UIViewController where you have the shifting table view

UditS
  • 1,936
  • 17
  • 37
  • I accepted the up vote. I don't have enough reputation points yet to make a difference it seems. Thanks again for your help. Oh I just hit accept. Sorry I am new. – glennsep Feb 01 '16 at 22:11