use*_*282 1 ios uipageviewcontroller
我正在向PageViewController添加三个视图控制器,如下所示:
[pvc setViewControllers:[NSArray arrayWithObjects:svc, bvc, tvc, nil] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
Run Code Online (Sandbox Code Playgroud)
}];
但是,应用程序会抛出异常并在此行停止.当我检查日志导航器时,它只是说'(lldb)'.出了什么问题?
编辑:好的,谢谢保罗.我对Objective-c很新; 如何实现这些方法来获取我的三个视图控制器之间的滑动?
这是appDelegate.m中的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.;
UIPageViewController *pvc = [[UIPageViewController alloc] init]; // Create new PageViewController
BarsViewController *bvc = [[BarsViewController alloc] init]; // Create BarsViewController
StopwatchViewController *svc = [[StopwatchViewController alloc] init]; // Create StopwatchViewController
TimerViewController *tvc = [[TimerViewController alloc] init]; // Create TimerViewController
[pvc setViewControllers:[NSArray arrayWithObjects:svc, bvc, tvc, nil] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
}];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; // Hide status bar
self.window.rootViewController = pvc; // Make tab bar controller the root view controller
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
您不能将3个viewcontrollers添加到uipageviewcontroller.您可以添加一个viewcontroller,也可以最多添加两个,具体取决于脊椎位置的设置.SetViewController是一个添加可见控制器的功能,2是您可以显示的最大值.查看下面的链接,SetViewController的条目有一个图表,显示您可以添加哪些控制器,具体取决于脊柱位置.
| 归档时间: |
|
| 查看次数: |
7427 次 |
| 最近记录: |