iOS-UIPageViewController';无法确定导航方向';
我有iOS-UIPageViewController';无法确定导航方向';,ios,objective-c,uitableview,uiscrollview,uipageviewcontroller,Ios,Objective C,Uitableview,Uiscrollview,Uipageviewcontroller,我有UIPageViewController,其中一个视图控制器是UITableViewController。每个UITableViewCell都可以折叠/展开以隐藏/显示嵌套的表视图。无论是否展开任何单元格,当我在UITableView中上下滚动时,有时都会出现此错误: 2015-08-12 20:11:15.184 MyApp[4506:172368] *** Assertion failure in -[_UIQueuingScrollView _didEndDraggingManualS
UIPageViewController
,其中一个视图控制器是UITableViewController
。每个UITableViewCell
都可以折叠/展开以隐藏/显示嵌套的表视图。无论是否展开任何单元格,当我在UITableView
中上下滚动时,有时都会出现此错误:
2015-08-12 20:11:15.184 MyApp[4506:172368] *** Assertion failure in -[_UIQueuingScrollView _didEndDraggingManualScroll], /SourceCache/UIKit_Sim/UIKit-3347.44.2/_UIQueuingScrollView.m:861
2015-08-12 20:11:15.261 MyApp[4506:172368] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to determine navigation direction'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d52bc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c94cbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010d52baca +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010b00b98f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 UIKit 0x000000010ba257a2 -[_UIQueuingScrollView _didEndDraggingManualScroll] + 151
5 UIKit 0x000000010ba2147d -[_UIQueuingScrollView _scrollViewDidEndDraggingWithDeceleration:] + 40
6 UIKit 0x000000010b49f8d0 -[UIScrollView _endPanNormal:] + 1415
7 UIKit 0x000000010b4a0ddc -[UIScrollView handlePan:] + 98
8 UIKit 0x000000010b7be656 _UIGestureRecognizerSendActions + 262
9 UIKit 0x000000010b7bd2f9 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 532
10 UIKit 0x000000010b7c1f16 ___UIGestureRecognizerUpdate_block_invoke662 + 51
11 UIKit 0x000000010b7c1e12 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 254
12 UIKit 0x000000010b7b7e8d _UIGestureRecognizerUpdate + 2796
13 UIKit 0x000000010b45b646 -[UIWindow _sendGesturesForEvent:] + 1041
14 UIKit 0x000000010b45c272 -[UIWindow sendEvent:] + 666
15 UIKit 0x000000010b422541 -[UIApplication sendEvent:] + 246
16 UIKit 0x000000010b42fcdc _UIApplicationHandleEventFromQueueEvent + 18265
17 UIKit 0x000000010b40a59c _UIApplicationHandleEventQueue + 2066
18 CoreFoundation 0x000000010d45f431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
19 CoreFoundation 0x000000010d4552fd __CFRunLoopDoSources0 + 269
20 CoreFoundation 0x000000010d454934 __CFRunLoopRun + 868
21 CoreFoundation 0x000000010d454366 CFRunLoopRunSpecific + 470
22 GraphicsServices 0x0000000110821a3e GSEventRunModal + 161
23 UIKit 0x000000010b40d8c0 UIApplicationMain + 1282
24 MyApp 0x000000010aad6eef main + 111
25 libdyld.dylib 0x000000010e2bc145 start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我很困惑为什么我会犯这个错误。我想知道我的外部UITableView
的UIScrollView
是否与我的UIPageViewController
的UIScrollView
冲突,尽管我只是偶尔会遇到这个错误
我在网上查到了这个错误,我只发现了几处提到它的地方,所以任何帮助或建议都将不胜感激。谢谢
编辑:很抱歉之前没有包含此内容,但是
UIPageViewController
具有水平导航。以下是我如何处理此问题的想法
userinteractionenabled=NO
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
手柄盘
- (void)panRecognized:(UIPanGestureRecognizer *)rec
{
CGPoint vel = [rec velocityInView:self.view];
if (vel.x > 0)
{
// user dragged towards the right
[self goToNextPage];
}
else
{
// user dragged towards the left
[self goToPrevPage];
}
}
这是你能做到的
希望这有帮助。干杯 幸运的是,我最终以自己的方式解决了这个bug。显然,苹果告诉我,
UIPageViewController
中的UIScrollView
和UITableViewController
中的那一个是冲突的,导致了这个错误
我所做的只是在整个视图上放置了一个uipangestureerecognizer
,每当用户向上或向下滚动时,UIPageViewController
中的UIScrollView
将被禁用,允许用户在UITableView
中滚动,而不会发生冲突或崩溃。当用户停止向上或向下滚动时,将重新启用UIPageViewController
的UIScrollView
我很沮丧,因为我没有更早地提出这个解决方案,但是哦,好吧
无论是谁遇到了同样的问题,他仍然困惑于我是如何解决问题的,请在下面进行评论,我将发布我的代码修复。您正在滑动哪个方向(在两个视图之间)。向上/向下?或右/左?是否需要
UIPageViewController
垂直滚动?如果没有,您可以禁用其垂直滚动。我想这与您的情况相同,很抱歉没有包括这一点,UIPageViewController具有水平导航。@Ganesh Somani-如何禁用页面视图控制器的垂直滚动?我有一个对UIPageViewController
的UIScrollView
的引用,但是我如何告诉它以编程方式从该函数开始滚动呢?我认为在你的if和else语句中,我应该插入以下代码:[self.\u scrollView.delegate scrollView didcoll:self.\u scrollView];由于禁用了用户交互,我假设这会起作用,因为我以编程方式告诉滚动视图滚动。如果我错了,请纠正我。您不应该使用scrollview更改任何内容,只需编写代码来更改页面视图。像一些函数,如goToNextPage
或goToPreviousPage
对不起,我不知道昨天为什么没有看到这个。我现在就试试这个。你好,你能把你的代码贴出来吗?谢谢:)嗨,瓦贝勒。我感觉到你的挫折,如果你随机得到这个错误以及。你多久吃一次?你能描述一下你的应用程序的蓝图并告诉我什么时候出现了错误吗?你可以在这个网站上发布一个问题,在这些评论中链接到我,我可以为你回答这个问题。最大的原因是这个网站不喜欢我们在评论中进行长时间的对话。谢谢