问题
I am using PageMenu in my project within a TabBar Controller and a Navigation Controller. When I initialize the "Scrolling menu" I use this to display it under the statusBar and the navigation bar :
pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRectMake(0, UIApplication.sharedApplication().statusBarFrame.size.height + self.navigationController!.navigationBar.frame.height, self.view.frame.width, self.view.frame.height), options: parameters)
This solution is working perfectly and display my menu exactly where I want ! Then I present an image picker view inside one of the scrolling view. After dismissing it, the menu goes back to the initial place (under the navigation bar)...
Any solution to avoid this issue ? (If you need more detail I can provide more code)
P.S. I'm not a native English speaker so I hope my question is understandable :)
回答1:
Added the viewcontroller "pageMenu" as a child of the parent controller and the problem was solved
回答2:
It's in Obj-C, but Swift is the same I think. In parent view controller, add pageMenu as child VC:
[self addChildViewController:_pageMenu];
In child VC, call picker by this:
UIViewController*vc=self.parentViewController.parentViewController;
[vc presentViewController:imagePickerController
animated:YES
completion:nil];
回答3:
the problem is pageMenu is add in viewDidLoad, and here view hasn't correct measures. Create a container view on storyboard and add PageMenu in container. Work for me, although it may not be good practice
来源:https://stackoverflow.com/questions/29519570/ios-swift-slidingmenuview-wrong-position-after-presenting-imagepicker