dOxxx
dOxxx

Reputation: 1539

UIPanGestureRecognizer won't pan right

I have a UIView subclass to which I have added a UIPanGestureRocognizer:

_panGestureRecognizer = [[UIPanGestureRecognizer alloc]
                         initWithTarget:self action:@selector(handlePanGesture:)];
_panGestureRecognizer.maximumNumberOfTouches = 1;
_panGestureRecognizer.delegate = self;
[self addGestureRecognizer:_panGestureRecognizer];

This view is used in a view hierarchy which includes a UISplitViewController as the top-level view/controller.

When testing this in the iPad simulator in landscape orientation, if I start the pan by going up/down/left, my handlePanGesture: method is called as expected. However, if I start the pan by going right then my handlePanGesture: method is not called. Why not?

Upvotes: 1

Views: 547

Answers (1)

dOxxx
dOxxx

Reputation: 1539

While I was writing up this question, I figured out the answer for myself:

The UISplitViewController since iOS 5 will, by default, recognize a swipe gesture to the right and display the popover controller. This is obvious in portrait orientation, however, in landscape orientation, the gesture has no apparent effect because the left-side view displayed as the popover in portrait is always displayed in landscape.

The solution to this is to disable the swipe gesture for the UISplitViewController with:

splitViewController.presentsWithGesture = NO;

I don't know if there is a way to have both gestures work.

Upvotes: 4

Related Questions