UIPopoverController gesture handling in UISplitViewController for iOS 5.1 and below

Posted by 5StringRyan on Stack Overflow See other posts from Stack Overflow or by 5StringRyan
Published on 2012-04-09T19:27:32Z Indexed on 2012/04/09 23:29 UTC
Read the original article Hit count: 541

I've (along with many others) have noticed that Apple changed the appearance of the popover controller to use a "slider" window rather than the usual "popover" tableview that I've used. While I'm okay with the new appearance, like others I'm having issues with the swipe gesture that is introduced:

iOS 5.1 swipe gesture hijacked by UISplitViewController - how to avoid?

The fix for this seems to be to set the split view controller method "presentWithGesture" to "NO."

UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
splitViewController.presentsWithGesture = NO;

This works great if the user is using iOS 5.1, however, if this code is run using iOS 5.0 or below, an exception is thrown since this method is only available for iOS 5.1:

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[UISplitViewController setPresentsWithGesture:]: unrecognized selector 

Is it possible to get rid of this gesture without using this method so that it's backwards compatible with iOS' 5.0 and below?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios5