val*_*ato 5 ibooks ios ios5 uipageviewcontroller
所以我正在尝试创建一个类似ibooks的阅读器,我需要在从webservice获取数据后动态更新UIPageViewController的内容.由于一系列原因,我必须在开头实例化它,然后在数据到来时更新它.
我正在创建它:
NSDictionary *options =
[NSDictionary dictionaryWithObject:
[NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin]
forKey: UIPageViewControllerOptionSpineLocationKey];
self.pageController = [[UIPageViewController alloc]
initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
options: options];
self.pageController.dataSource = self;
self.pageController.delegate = self;
[[self.pageController view] setFrame:[[self view] bounds]];
MovellaContentViewController *initialViewController = [self viewControllerAtIndex:0];
self.controllers = [NSArray arrayWithObject:initialViewController];
[self.pageController setViewControllers:self.controllers
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];
Run Code Online (Sandbox Code Playgroud)
然后我就开始了 self.controllers = newControllersArray;
我正在寻找像UITableViewController的reloadData之类的东西,UIPageViewController有这样的东西吗?
Jör*_*ich 11
您必须再次向setController发送setViewControllers:direction:animated:completion:并为其显示第一个视图控制器:
[self.pageController setViewControllers:[NSArray arrayWithObject:
[self viewControllerAtIndex:0]
]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
Run Code Online (Sandbox Code Playgroud)
如果viewControllerAtIndex:不像self.controllers我最初假设的那样访问,那么它可能应该是
[self.pageController setViewControllers:[NSArray arrayWithObject:
[self.controllers objectAtIndex:0]
]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
Run Code Online (Sandbox Code Playgroud)
代替
主要问题是 webview 拦截了所有用户触摸,因此 UiPageViewController 没有调用委托方法。一旦将 webview 设置为忽略用户触摸事件,一切就开始正常工作。
| 归档时间: |
|
| 查看次数: |
11202 次 |
| 最近记录: |