I have got a PageViewController
that I created in a ViewController
, as you can see next:
MainViewController (viewDidLoad())
self.pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
self.pageViewController.dataSource = self
self.pageViewController.delegate = self;
self.pageViewController.view.frame = CGRectMake(0, 100, self.view.frame.size.width, self.view.frame.size.height)
let initialViewController : UIViewController! = viewControllerArray.objectAtIndex(self.currentPageIndex) as! UIViewController
let viewControllers: NSArray? = NSArray(objects: initialViewController)
pageViewController.setViewControllers(viewControllers as? [UIViewController], direction: .Forward, animated:true, completion: nil)
self.addChildViewController(self.pageViewController)
self.view.addSubview(self.pageViewController.view)
self.pageViewController.didMoveToParentViewController(self)
self.syncScrollView()
And everything is all right. This viewController
catch the event on the method
func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int
My problem is that one of the pages of this pageViewController has other UIPageViewController inside, with other UIViewController associated. The way I am creating the other UIPageViewController is:
SecondViewController (viewDidLoad()
)
self.pageNoticiaViewcontroller = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Vertical, options: nil)
self.pageNoticiaViewcontroller.didMoveToParentViewController(self);
self.pageNoticiaViewcontroller.dataSource = self;
self.pageNoticiaViewcontroller.delegate = self;
let startVC = self.getControllerAtIndex(0) as InicioIndividualUIViewController;
let viewControllers = NSArray(object: startVC);
self.pageNoticiaViewcontroller.setViewControllers(viewControllers as? [UIViewController], direction: .Forward, animated: true, completion: nil);
self.pageNoticiaViewcontroller.view.frame = CGRectMake(0, 0, self.view.frame.width, self.view.frame.height - 40);
self.addChildViewController(self.pageNoticiaViewcontroller);
self.view.addSubview(self.pageNoticiaViewcontroller.view);
The problem is:
The second PageViewController (pageNoticiaViewController
) doesn't call to the method presentationCountForPageViewController
but it calls to the method presentationCountForPageViewController
of the parent
How can I do that second PageViewController
calls to method presentationConuntForPageViewController
of the second UIViewController, insetead of call to method of the parent? Thank you very much!