iOS: notch superview change to first object

This commit is contained in:
王劲鹏 2021-01-18 16:37:00 +08:00 committed by osborn
parent 365124dfc9
commit 510cdf53cb

View File

@ -32,7 +32,13 @@ - (instancetype)initWithContext:(DoricContext *)doricContext {
- (void)inset:(NSDictionary *)argument withPromise:(DoricPromise *)promise {
dispatch_async(dispatch_get_main_queue(), ^{
if (@available(iOS 11.0, *)) {
UIView *superView = [UIApplication sharedApplication].windows.lastObject;
UIView *superView;
if (self.doricContext.vc) {
superView = self.doricContext.vc.view.window;
} else {
superView = [UIApplication sharedApplication].windows.lastObject;
}
CGFloat top = superView.safeAreaInsets.top;
CGFloat left = superView.safeAreaInsets.left;
CGFloat bottom = superView.safeAreaInsets.bottom;