2

I have a problem,

I am programming with Monotouch 5.2.8 for IOS 5.1.

But since the IOS 5.1 update my iPad configs the UISplitViewController so it is docked on the left side instead of presented as a popover.

It works with IOS 5.0 but in 5.1 i got this problem.

Here is the source code for my UISplitViewController:

splitViewController = new UISplitViewController ();
splitViewController.WeakDelegate = detailViewController;                
splitViewController.ViewControllers = new UIViewController[] {
     navigationController,
     detailViewController                   
};
Naveen Shan
  • 9,192
  • 3
  • 29
  • 43
Alex
  • 459
  • 3
  • 14
  • Is it okay to discuss iOS 5.1 features here in public? Since Xcode and new versions are distributed through App Store it is no longer so obvious that it might be under NDA. I'm missing the reddish NDA info box when trying to download the latest SDK. – Krumelur Mar 09 '12 at 20:11

2 Answers2

5

From Apple's iOS 5.1 SDK release notes:

In 5.1 the UISplitViewController class adopts the sliding presentation style when presenting the left view (previously only seen in Mail). This style is used when presentation is initiated either by the existing bar button item provided by the delegate methods or by a swipe gesture within the right view. No additional API adoption is required to obtain this behavior, and all existing API, including that of the UIPopoverController instance provided by the delegate, will continue to work as before. If the gesture cannot be supported in your app, set the presentsWithGesture property of your split view controller to NO to disable the gesture. However, disabling the gesture is discouraged because its use preserves a consistent user experience across all applications.

Here (login required).

UPDATE:

From what I understand on the above, we can kiss the automatic popover appearance of the master controller goodbye in iOS 5.1.

The only way I see is possible to keep the "old" appearance, is by implementing our own UIPopoverController and taking advantage of the ShouldHideViewController delegate method. Thankfully with MonoTouch, we have that method available as a property in the UISplitViewController class, making things a bit simpler.

I do get a strange behavior though. With iOS SDK 5.1 on my Mac and iOS 5.1 on my iPad; on the device, I get the "sliding" appearance, while on the simulator I get the "old", popover appearance. This is with MonoTouch 5.2.4, which is the latest stable version. Also, it does not contain a PresentsWithGesture property. I tried setting its value to false through MonoTouch.ObjCRuntime messaging, but no luck. The selector keeps returning true. So I cannot deactivate the swipe gesture.

Even tried creating my own UIPopoverController and assigning it as the master in the split controller to see what happens. Doesn't work because UIPopoverController is not a UIViewController...

Some useful info in this question, for ObjC.

Community
  • 1
  • 1
Dimitris Tavlikos
  • 8,170
  • 1
  • 27
  • 31
  • I tried to set the Property "presentsWithGesture to false(NO), but nothing changes.=( – Alex Mar 09 '12 at 11:18
  • @Dimitris Tavlikos: I interpret that "presentsWithGesture" property in a sense that the split controller will still show the same behavior but if sliding from left to right or back, nothing will happen. Or in other words: if your app itself already has a similar slide gesture, you will want to set this property to false. – Krumelur Mar 09 '12 at 20:07
  • But for answering my Question. How do I deactivate this 'new UISplitViewController' and get the old UISplitViewController?? Or is this not possible? – Alex Mar 13 '12 at 19:15
  • @Alex: Just updated my answer, excuse the delay. Krumelur, that is correct about the "presentsWithGesture". – Dimitris Tavlikos Mar 15 '12 at 09:35
  • @DimitrisTavlikos Okay thank you very much, but i have resigned and now I'm using the "new" slideable UISplitViewController. But I will try your solution and mark your answer as the right answer. – Alex Mar 15 '12 at 11:28
2

Turns out you can disable the presentsWithGesture in the application delegate, but once the view controllers have been presented, there is no changing it.

I needed to disable the appearance of the left view controller during a login process, but turns out I can't enable it later.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Pablo
  • 21
  • 1
  • Check out the comment by daveywc, you can call setNeedsLayout and re-point your delegate in order to change this on the fly: http://stackoverflow.com/questions/10078616/uipopovercontroller-gesture-handling-in-uisplitviewcontroller-for-ios-5-1-and-be – Robert Zahm Oct 30 '12 at 19:59