问题
My architecture of viewcontrollers are:
mainViewController(full-screen)
|
V
pageViewController(part-of-screen)
| |
V V
tableViewController1 tableViewController2
Unlike most of existing posts, the UIPageViewController is set to style: UIPageViewControllerTransitionStyleScroll, which means that pageVC.gestureRecognizers is empty, and I can NOT find the tapGuesture to disable.
I've searched the site for a whole afternoon, and find NO solution (most answers are related to the pageCurlStyle). What I've tried includes:
- setting the tableViewController.view's delegate to mainViewController, useless
- implement gestureRecognizer:shouldReceiveTouch, not even called
- pageVC.gestureRecognizers is empty
I haven't tried to do UITouch level things, that will be kind of dirty, and would be the last step to try.
My code is attached below, some explanations:
- UIPageViewController* pageVC is a data member of mainViewController)
- listVCs contains the UITableViewControllers
the code:
// 3. create page view controller
pageVC = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
pageVC.dataSource = self;
pageVC.delegate = self;
pageVC.doubleSided = NO;
pageVC.view.frame = _viewLayoutRef.frame;
// 3.1 set the VCs into pageVC
NSArray* aVC = @[[listVCs objectAtIndex:0]];
[pageVC setViewControllers:aVC direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
// 3.2 hook page view controller
[self addChildViewController:pageVC];
[self.view addSubview:pageVC.view];
[pageVC didMoveToParentViewController:self];
回答1:
From your view hierarchy...Your are feeding the view controllers(UITableViewcontroller
) to UIPageViewController
right? Instead of UITableViewController
you can create UIViewController
in which you can add UITableview
.
来源:https://stackoverflow.com/questions/24508369/uitableview-embedded-in-uipageviewcontroller-scrollstyle-cannot-be-tapped-di