0

I am using UIPageViewController to show 2 tabs, they are appearing perfect when I navigate to the PageViewController but when I navigate to any detail view from PageViewController and come back then UIPageViewController shifts up. This only happen when I navigate from one of a child view controller of another PageViewController to the current PageViewController otherwise no issue.

This is the first child view controller from when I am navigating to a different PageViewController

This is the first child view controller from when I am navigating to a different <code>PageViewController</code>

This is the actual PageViewController causing the problem, currently no issue navigating to this screen

This is the actual <code>PageViewController</code> causing the problem, currently no issue navigating to this screen

Now the whole view is shifted up after I came back to this screen from another screen!

Now the whole view is shifted up after I came back to this screen from another screen!!

Any help would be much appreciated. Thanks!

Paras Gorasiya
  • 1,295
  • 2
  • 13
  • 33
  • Are you using Storyboard ? If yes it might be problem of setting scroll view insets. check this http://stackoverflow.com/a/18924484/1423703 – Alok Rao Dec 08 '16 at 09:28
  • No, I am not using storyboard but generating a view programatically. So I can't use your suggestion. Thanks – Paras Gorasiya Dec 08 '16 at 09:53

2 Answers2

0

link use this, it works perfect

Pavankumar
  • 288
  • 1
  • 10
0

Figured out the solution by adding self.edgesForExtendedLayout = UIRectEdgeNone; when navigating from a particular screen. The issue was occurring only when I navigate from another child view controller of a page view controller.

Paras Gorasiya
  • 1,295
  • 2
  • 13
  • 33