问题
I created my project based on single view application. My application at first has
FoodTableViewContoller --> Details: ItemViewController (Contain "Item" as model).
I have an array named itemArray that contain all the items. I wish to implement pageViewController (or similar other function) that user can swipe right or left to browse the item in itemArray. I followed the tutorial here and further implement in my existing project but it ended up in an infinite loop (Never goes through D log and back to A) when I clicked on one of my table cell. Is it possible to implement pageView in my tableView details?
Here is part of my codes:
NSLog(@"A");
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
options:nil];
NSLog(@"B");
self.pageViewController.dataSource = self;
ItemViewController *itemViewController = [[ItemViewController alloc] init];
itemViewController.item = self.item;
NSLog(@"C %@", itemViewController.item);
NSArray *viewControllers = [NSArray arrayWithObject:itemViewController];
NSLog(@"D");
[self.pageViewController setViewControllers:viewControllers
direction:UIPageViewControllerNavigationDirectionForward
animated:NO completion:nil];
NSLog(@"E");
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
[self.view addSubview:self.scrollView];
NSLog(@"F");
来源:https://stackoverflow.com/questions/18547555/implement-pageviewcontroller-in-tableviewcontroller-details