相关疑难解决方法(0)

UIPageViewController中的断言失败

虽然在UIPageViewController中切换选项卡太快,但App会崩溃

[UIPageViewController queuingScrollView:didEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:]
Run Code Online (Sandbox Code Playgroud)

有错误断言失败和由于未捕获的异常'NSInternalInconsistencyException'终止应用程序,原因:'没有视图控制器管理可见视图.

错误记录如下

*** Assertion failure in -[UIPageViewController queuingScrollView:didEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:], /SourceCache/UIKit/UIKit-3318.0.1/UIPageViewController.m:1875
2014-09-29 11:34:00.770 Wowcher[193:9460] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No view controller managing visible view <UIView: 0x1783fa80; frame = (0 0; 320 416); autoresize = W+RM+H+BM; layer = <CALayer: 0x17898540>>'
*** First throw call stack:
(0x219fbf87 0x2f15ac77 0x219fbe5d 0x226cb2c9 0x253f9fff 0x2546f8d3 0x2546f6b7 0x2546c2b9 0x254700db 0x25470f97 0x2546d037 0x24ea925f 0x2500a589 0x24ff7eef 0x24ea677d 0x252b8c81 0x24e70105 0x24e6e07f 0x24ea4b6d 0x24ea443d 0x24e7acc5 0x250ee513 0x24e79707 0x219c2807 0x219c1c1b 0x219c0299 0x2190ddb1 0x2190dbc3 0x28c99051 0x24ed9a31 …
Run Code Online (Sandbox Code Playgroud)

xcode ios uipageviewcontroller

40
推荐指数
3
解决办法
2万
查看次数

如果用户移动太快,UIPageViewController视图会搞乱

我有一个UIPageViewController使用整数来告诉它在哪个页面.它工作正常,但如果用户快速滑动几次以进一步返回页面,整数变化的速度比视图更快,然后整个事情就会崩溃(应用程序认为它在第7页可能是显示第3页).我究竟做错了什么?我应该用不同的方法来判断我在哪里吗?谢谢.

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
    if (pageNumber == 0) {
        pageNumber++;
        NSLog(@"%i", pageNumber);
        Two *two = [[Two alloc] init];
        return two;
    } else if (pageNumber == 1) {
        pageNumber++;
        NSLog(@"%i", pageNumber);
        Three *three = [[Three alloc] init];
        return three;
    } else if (pageNumber >= 2) {
        return nil;
    } else {
        return nil;
    }
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ipad ios uipageviewcontroller

7
推荐指数
1
解决办法
3543
查看次数

标签 统计

ios ×2

uipageviewcontroller ×2

ipad ×1

iphone ×1

objective-c ×1

xcode ×1