DVANestedPageViewController 是 UIPageViewController 的干净、易于使用的封装
只需将以下内容添加到您的 Podfile 中即可
pod 'DVANestedPageViewController'
DVANestedPageViewController.h/m
、DVAVerticalPageViewController.h/m
和 UIViewController+Notifications.h/m
添加到您的项目中。(请参阅位于 /NestedPageViewController
中的示例 Xcode 项目,用于使用故事板)
将 DVANestedPageViewController 实例作为容器视图控制器添加(通过代码或故事板)并实现以下 dataSource 和 delegate 方法
@protocol DVANestedPageViewControllerDataSource <NSObject>
- (NSUInteger)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController numberOfViewControllersAtSection:(NSUInteger)section;
- (UIViewController *)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController viewControllerAtIndexPath:(NSIndexPath *)indexPath;
@optional
- (NSUInteger)nestedPageViewControllerNumberOfSections:(DVANestedPageViewController *)nestedPageViewController; // 1 by default
@end
@protocol DVANestedPageViewControllerDelegate <NSObject>
@optional
- (void)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController viewControllerWillAppear:(UIViewController *)viewController atIndexPath:(NSIndexPath *)indexPath;
- (void)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController viewControllerDidAppear:(UIViewController *)viewController atIndexPath:(NSIndexPath *)indexPath;
- (void)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController viewControllerWillDisappear:(UIViewController *)viewController atIndexPath:(NSIndexPath *)indexPath;
- (void)nestedPageViewController:(DVANestedPageViewController *)nestedPageViewController viewControllerDidDisappear:(UIViewController *)viewController atIndexPath:(NSIndexPath *)indexPath;
@end
DVANestedPageViewController 是由 Miguel Ferrando 提供。欢迎贡献。如果您在项目中使用 DVANestedPageViewController,请通知我!。