前言
博主在裁图的时候遇到的,拖拽顶部自定义裁图边线把系统通知中心拉下来了
3E35FF123EB8F5DE591ED5110210056F.jpg
分析
在iOS11之前是不会直接拉拉下来的,需要拉2次,在iOS11的时候需要专门判断
方法
iOS11扩展了两个方法其中有一个就是解决当下问题的
@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 gestures have changed.
- (void)setNeedsUpdateOfScreenEdgesDeferringSystemGestures API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(watchos, tvos);
@end
当UIRectEdge的枚举为UIRectEdgeTop就能解决
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
return UIRectEdgeTop;
}
网友评论