有时候你的App需要控制从状态栏下拉或者底部栏上滑,这个会跟系统的下拉通知中心手势和上滑控制中心手势冲突。
如果你要优先自己处理手势可以将系统手势延迟。
@interface UIViewController (UIScreenEdgesDeferringSystemGestures)
// Override to return a child view controller or nil. If non-nil, that view controller’s screen edges deferring system gestures will be used. If nil, self is used. Whenever the return value changes, -setNeedsScreenEdgesDeferringSystemGesturesUpdate should be called.
- (nullable UIViewController *)childViewControllerForScreenEdgesDeferringSystemGestures API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(watchos, tvos);
// Controls the application’s preferred screen edges deferring system gestures when this view controller is shown. Default is UIRectEdgeNone.
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(watchos, tvos);
// This should be called whenever the return values for the view controller’s screen edges deferring system

本文介绍了如何在iOS应用中控制自定义手势优先于系统下拉通知中心和上滑控制中心的手势。通过重写UIViewController的相关方法,可以阻止用户从屏幕边缘侧滑调出系统快捷菜单,实现自定义手势的优先处理。
最低0.47元/天 解锁文章
990

被折叠的 条评论
为什么被折叠?



