UPDATE 2
I\'ve been running and testing my app in the iOS Simulator using a 4-inch device. If I run using a 3.5-inch device the label doesn\'t jump.
As stated by "Bo:": Putting self.edgesForExtendedLayout = UIRectEdgeNone; in the viewDidLoad of MyPageViewController solved the problem. – Bo
Swift's version of djibouti33's answer (excluding the line that is not part of the problem resolution)
Swift 3.0
override func viewDidLoad() {
super.viewDidLoad()
self.automaticallyAdjustsScrollViewInsets = false
}
this is my first time posting on stack overflow, but I have searching for a solution to this problem for over a week now.
Here is a solution I came up with, I hope this works for anyone else with the same issue.
I'm not sure how you are initializing your frame for your detail view controller, but I am going to assume you might use: self.view.frame.size.height;
try using: self.view.frame.size.height -= self.navigationController.navigationBar.bounds.size.height;
Hope this helps
I have the same problem. I solve it by putting setViewControllers for the first page in UIPageViewController's viewDidLoad instead of setting it when I make a instance of UIPageViewController. Also, I need to set automaticallyAdjustsScrollViewInsets to NO.
So I'm adding another answer after further development and I finally think I figured out what's going on. Seems as though in iOS7, UIPageViewController has its own UIScrollView. Because of this, you have to set automaticallyAdjustsScrollViewInsets
to false. Here's my viewDidLoad
now:
- (void)viewDidLoad
{
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = false;
DetailViewController *detail = [[DetailViewController alloc] init];
[self setViewControllers:@[detail]
direction:UIPageViewControllerNavigationDirectionForward
animated:false
completion:nil];
}
No need to put anything in viewWillLayoutSubviews
(as one of my previous answers suggested).
None of above worked for me
Here I found the solution
var pageMenu : CAPSPageMenu?
Instead of adding like this
self.view.addSubview(pageMenu!.view)
Add your CAPSPageMenu like below
addChildViewController(pageMenu!)
self.view.addSubview(pageMenu!.view)
pageMenu!.didMove(toParentViewController: self)
Reference: iOS Swift : SlidingMenuView wrong Position after presenting imagePicker
Happy Coding!