Reputation: 685
I have a UIPageViewController
in it have I have 4 pages. One of my pages have UISegmentControl
where the user either tap or swipe the page to change segments. I think it is inside UIPageController so swipe takes to different page rather than swipe action in UISegmentControl or might be some silly mistake on my part. here's what I have done. I have added two gesture recognizers swipe Left and swipe right. and done this in storyboard
Upvotes: 1
Views: 136
Reputation: 6379
Two solution:
1.Handle all swipe gestures in UIPageViewController.If you don't want to change your detail view controller,you can add a public func to change some values.In UIPageViewControllerDataSource
you can return any view controller you want to present.
2.Use UIGestureRecognizerDelegate.If you don't want get this gesture,just return NO/false.(set delegate for gesture in UIPageViewController)
// get gesture recognizer and set delegate
self.pageViewController!.gestureRecognizers
// decide if page controller should receive gesture
public func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool
Upvotes: 1