UIScreenEdgePanGestureRecognizer:顶部和底部边缘 [英] UIScreenEdgePanGestureRecognizer: top and bottom edges

查看:86
本文介绍了UIScreenEdgePanGestureRecognizer:顶部和底部边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使 UIScreenEdgePanGestureRecognizer 顶部(或底部)边缘处理事件?

Is this possible to make UIScreenEdgePanGestureRecognizer handle events from top (or bottom) edge?

UIScreenEdgePanGestureRecognizer *gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(userDidPan:)];
gestureRecognizer.edges = UIRectEdgeTop;  // UIRectEdgeBottom
[self.view addGestureRecognizer:gestureRecognizer];

致谢.

推荐答案

状态栏必须隐藏才能正常工作.在您的UIViewController中,覆盖 (BOOL)prefersStatusBarHidden()并返回是.

The status bar must be hidden so it works. In your UIViewController, override (BOOL)prefersStatusBarHidden() and return YES.

但是在ios8中(未在ios7中进行测试).我遇到了一些问题,当设备方向为横向向左"时,无法识别底部手势(当设备方向为横向向右"时,无法识别顶部手势).我正在调查,但对我来说似乎是个bug.

However in ios8 (didn't test in ios7). I've got some issues with the bottom gesture not recognized when the device orientation is Landscape Left (and the top gesture is not recognized when the device orientation is Landscape right). I'm investigating but looks like a bug to me.

这篇关于UIScreenEdgePanGestureRecognizer:顶部和底部边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆