Dar*_*ren 6 uinavigationcontroller uigesturerecognizer ios
我有一个仅限 iPhone 的应用程序,它使用 UIScreenEdgePanGestureRecognizer 在 UINavigationController 中实现自定义交互式转换。手势识别器在 UINavigationController 子类的 viewDidLoad 中创建并添加如下:
UIScreenEdgePanGestureRecognizer* edgeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
edgeRecognizer.edges = UIRectEdgeLeft;
[self.view addGestureRecognizer:edgeRecognizer];
Run Code Online (Sandbox Code Playgroud)
当应用程序在 iPad 上运行时,当我尝试滑动以从导航堆栈中弹出视图控制器时,应用程序中没有任何反应,如果我在应用程序窗口所在位置的左侧启动手势,我会得到以下控制台输出:
_UIApplicationHandleEventFromQueueEvent、_windowServerHitTestWindow 中出现意外的 nil 窗口:;层=>
有谁知道这个问题的原因以及我如何/是否可以解决这个问题?到目前为止,我在文档中找不到任何表明边缘平移手势不应在兼容模式下运行的内容。我正在 iOS 8 中进行测试。
该手势在模拟器中有效,但在设备上无效。
小智 -1
如果您正确创建了故事板及其视图控制器和导航控制器,则动画默认创建(边缘向左滑动以展开)。但如果不是您的情况,您可以尝试使用 UnwindSegue 或解雇函数。但我不知道“pan:”方法是做什么的。
\n\n我在 iPad 上的一个应用程序中执行了此操作,它正确调用了该函数:
\n\n- (void)viewDidLoad\n{\n UIScreenEdgePanGestureRecognizer *leftEdgeGesture = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self\n action:@selector(openLeftSideBar)];\n leftEdgeGesture.edges = UIRectEdgeLeft;\n}\n\n- (void)openLeftSideBar\n{\n //the code\n\n}\nRun Code Online (Sandbox Code Playgroud)\n\n在你\xe2\x80\x99re的情况下,你可以调用Unwind segue到你想要回滚的视图控制器,或者如果你想要回滚的视图控制器就在当前视图控制器的后面,使用这样的dismiss函数:
\n\n[self dismissViewControllerAnimated:YES completion:nil];\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
759 次 |
| 最近记录: |