繁体   English   中英

UINavigationController.hidesBarsOnSwipe=YES 导致 NSInternalInconsistencyException

[英]UINavigationController.hidesBarsOnSwipe=YES leads to NSInternalInconsistencyException

我在 UINavigationController 中嵌入了一个 UITableViewController。 一切正常,直到我在 viewWillAppear 中将 UINavigationController 的属性 hidesBarsOnSwipe 设置为 YES。 如果用户要稍微紧张地上下滚动,应用程序会崩溃并显示以下消息:

 2016-10-10 13:47:27.973 xxx[4246:1716033] *** Assertion failure in -[_UIAnimationCoordinator finishInteractiveAnimation], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/_UIAnimationCoordinator.m:154 2016-10-10 13:47:27.974 xxx[4246:1716033] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Trying to finish an interactive transition that was not started interactively'

以下代码似乎是一种解决方法,但尽管如此,我还是想弄清楚,如果其他人有类似的问题并且可能找到了更好的解决方案。 提前谢谢你!

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if(scrollView.contentOffset.y <= 10)
    {
        //scrollup
        scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
        [self.navigationController setNavigationBarHidden: NO animated:YES];
    }
    else if(scrollView.contentOffset.y >= 10)
    {
        //scrolldown
        [self.navigationController setNavigationBarHidden: YES animated:YES];
    }        
}

顺便说一句:我可以在使用 XCode 7.3 的模拟器和设备上的 iOS 9.3.5 和 10.0.2 中重现此行为

对于有同样问题并像我一样进入此页面的每个人。

我修复了只打开属性检查器导航控制器“隐藏栏”->“滑动时”(取消选中)的问题。

希望它可以帮助某人。

(xcode 11.5,操作系统 13.5.1)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM