After experimenting, I wondered what would happen if I tried to create my own gesture of gestures to open the main view. This works great, and it won't work when using the sliders!
So, in application deletion, I suppress the default gesture:
splitViewController.presentsWithGesture = NO;
When the detail view loads, I create a gesture of gestures:
- (void)viewDidLoad { [super viewDidLoad]; UISwipeGestureRecognizer *swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightSwipe:)]; swipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight; [self.view addGestureRecognizer:swipeGestureRecognizer]; [self configureView]; }
In splitViewController: willHideViewController: withBarButtonItem: forPopoverController: I keep the links that I need to open the main view:
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController {
Finally, I process the napkins:
- (void)handleRightSwipe:(UISwipeGestureRecognizer *)recognizer {
Slide in the main controller. I was worried that this would display the controller as a traditional popover (with arrows, etc.), but actually it does the right thing (at least in iOS 7 - I have not tested earlier versions).
Note that you need to create this gesture for each view that you click on the navigation controller stack. In my case, it is always the same view, which simplifies things. In other cases, it might be a good idea to subclass a UIViewController that creates this gesture and processes it, and then use it as a superclass for any controllers that are clicked ...
tarmes
source share