UIScreenEdgePanGestureRecognizer:顶部和底部边缘 [英] UIScreenEdgePanGestureRecognizer: top and bottom edges
问题描述
是否可以使 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屋!