1

I am using auto layout for a controller under navigation controller. For this controller, I mainly have a scroll view inside the controller's view. the alignment rule for the scroll view is top layout guide, bottom layout guide, leading aligned with super view and trailing as well.

the layout is fine when I load the view at first first loaded screen, then I pressed the add a description button, it pushes to next screen and after that the screen is going to show up again, but it becomes like this now screen after popping back.

there is some mysterious white space between the navbar and the scroll view all of sudden. my guess is that the top layout guide is misplaced. anyway I can fix this or anything I have done wrongly?

Junchao Gu
  • 1,815
  • 6
  • 27
  • 43
  • 2
    check this..http://stackoverflow.com/questions/19111451/ios-7-uitableview-how-to-remove-space-between-navigation-bar-and-first-cell – Bhavin Bhadani Jun 23 '15 at 03:58
  • seems to be working--well, this problem does not happen every time too. can you explain a bit? the most voted answer actually worked but does that mean the auto scrollviewinsets is inserted after popping back? – Junchao Gu Jun 23 '15 at 04:08

2 Answers2

3

Simply you add below code

self.automaticallyAdjustsScrollViewInsets = NO;

in - (void)viewDidLoad method

Mahesh
  • 956
  • 10
  • 17
  • I saw this answer in the link provided by Bhavin but I am not sure why this works – Junchao Gu Jun 23 '15 at 05:55
  • I got the same issue and I solved my issue by above code so I suggest you. You can get better idea from [TransitionGuide from apple developer](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/AppearanceCustomization.html) – Mahesh Jun 23 '15 at 08:31
1

Here is simple answer for you

https://stackoverflow.com/a/18974954/2382237

Try to change edgesForExtendedLayout for your viewController

self.edgesForExtendedLayout = UIRectEdgeAll;
self.extendedLayoutIncludesOpaqueBars = YES;

Hope this helps.

Community
  • 1
  • 1
Doro
  • 2,413
  • 2
  • 14
  • 26