在IOS开发人员库中,说明如下:
要直接控制正在显示的内容,请调用
setViewControllers:direction:animated:completion:
方法
这就是我想要做的事情,但没有成功。
以下是我在RootViewController.m
中尝试过的内容:
NSLog(@"%s", __FUNCTION__ );
[self.pageViewController setViewControllers:
[NSArray arrayWithObjects:
[self.storyboard instantiateViewControllerWithIdentifier:
@"AlbumPageViewController4"],nil]
direction:UIPageViewControllerNavigationDirectionForward
animated:YES completion:nil];
我知道AlbumPageViewController.m按钮正在调用它,因为它显示在NSLog中。但没有任何反应,没有崩溃,没有错误,没有页面卷曲。我的脊椎位置是UIPageViewControllerSpineLocationMin所以我想我只需要传递它1个视图控制器。
我试过2,但这也不起作用。
我怎样才能有一个按钮,让我“让用户跳转到内容中的特定位置”,就像文档说的那样?
答案 0 :(得分:0)
直接从另一个类调用RootViewController中的函数不起作用。所有的自我都是零 在设置了一些委托并让RootViewController监听并响应另一个类之后,代码就可以了。