美文网首页
解决ios11上 从状态栏下拉或底部栏上滑,跟系统的下拉通知中心

解决ios11上 从状态栏下拉或底部栏上滑,跟系统的下拉通知中心

作者: 沃伦盖茨 | 来源:发表于2018-01-24 12:07 被阅读2088次

有时候你的App需要控制从状态栏下拉或者底部栏上滑,这个会跟系统的下拉通知中心手势和上滑控制中心手势冲突。

如果你要优先自己处理手势可以将系统手势延迟。

@interfaceUIViewController(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.

- (nullableUIViewController*)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 gestures have changed.

- (void)setNeedsUpdateOfScreenEdgesDeferringSystemGestures API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(watchos, tvos);

@end

例如:

- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures

{

returnUIRectEdgeTop;

}

设置后下拉状态栏只会展示指示器,继续下拉才能将通知中心拉出来。如果返回UIRectEdgeNone则会直接下拉出来。

相关文章

网友评论

      本文标题:解决ios11上 从状态栏下拉或底部栏上滑,跟系统的下拉通知中心

      本文链接:https://www.haomeiwen.com/subject/ohxuaxtx.html