I'm on Monotouch 5.2.6 and iOS SDK 5.0.1.
I have a UIPageViewController that is a child container of another view controller. It is created like this:
pageViewController = new UIPageViewController (UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
this.AddChildViewController (pageViewController);
pageViewController.DidMoveToParentViewController (this);
this.viewCurrentMode.AddSubview (pageViewController.View);
If I rotate the device (Simulator), I get this exception in UIApplication.SendEvent()
:
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: The number of provided view controllers (1) doesn't match the number required (2) for the requested spine location (UIPageViewControllerSpineLocationMid)
The spine location is NOT "mid" but "min". Any ideas?
True, you have initialized the UIPageViewController with "Min" as spine location. However, you need to implement a delegate for your page controller and override the GetSpineLocation
method:
public override UIPageViewControllerSpineLocation GetSpineLocation (UIPageViewController pageViewController, UIInterfaceOrientation orientation)
{
//return spine location according to interface orientation and whatever
//criteria you prefer
}
Or, assign a method to its GetSpineLocation
property (MonoTouch heaven! ):
pageViewController.GetSpineLocation = (p, o) => return <spinelocation>;
Still, it looks a bit unexpected behavior. I assume that the default implementation of the native pageViewController:spineLocationForInterfaceOrientation:
method returns "Mid" when the device rotates to landscape (although could not find info in Apple docs). Anyway, you must override the above method to get it right.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With