提问人:andy 提问时间:5/4/2020 更新时间:5/5/2020 访问量:34
导航栏框架错误时,自定义窗口显示
navigaiton bar frame is wrong when a custom window displaying
问:
我有一个新的自定义 UIWindow 来显示仅支持UIInterfaceOrientationMaskLandscapeLeft
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeLeft;
}
只需点击一个按钮即可打开“SET WINDOW.HIDDEN = NO”
- (void)show {
UIWindowScene *scence = [UIApplicationsharedApplication].connectedScenes.allObjects.firstObject;
self.window = [[CustomWindow alloc]initWithWindowScene:scence];
CustomViewController *vc = [[CustomViewController alloc]init];;
self.window.rootViewController = vc;
self.window.hidden = NO;
self.window.windowLevel = 2;
[self.window makeKeyAndVisible];
}
和单个按钮关闭“set window.hidden = YES”,
- (void)close {
self.window.hidden = YES;
self.window = nil;
}
一切都很好,但是当我打开窗口并返回背景时,我进入前景,然后关闭窗口,就不在位置上了。navigationbar
答:
0赞
andy
5/5/2020
#1
我已经修复了这个错误。 在显示自定义窗口之前使用 presentViewController a temp vc。
- (IBAction)showApp:(id)sender {
UIViewController *vc = [[UIViewController alloc]init];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
self.tempVc = vc;
[self presentViewController:vc animated:NO completion:^{
[self.app show];
}];
}
评论