问题
I have two view controllers, let's call them transmit and receive. They are instantiated from storyboard in my parent view controller's viewDidLoad
, and the first one is initially added to a UIPageViewController
.
I've also set up a data source for the page view controller, with the following methods:
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
viewControllerAfterViewController:(UIViewController *)viewController {
if ([viewController class] == [PRTransmitViewController class]) {
return self.receiveViewController;
}
else {
return self.transmitViewController;
}
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
viewControllerBeforeViewController:(UIViewController *)viewController {
if ([viewController class] == [PRReceiveViewController class]) {
return self.transmitViewController;
}
else {
return self.receiveViewController;
}
}
My question is: is it OK to arrange an endless cycle like this? As I understand, the currently presented view controller is replaced and the previous one is unloaded. Do you anticipate any memory management problems with this arrangement as the user goes from screen to screen in a loop?
来源:https://stackoverflow.com/questions/16239868/cycling-from-last-to-first-and-vice-versa-with-uipageviewcontroller