我的应用程序具有调用功能。调用电话时,会转到默认电话应用程序。现在,在通话过程中,我正在访问我的应用程序,当时我的应用程序在导航栏上显示绿色栏。如果我进入下一个详细信息屏幕,所有 UI 都会受到干扰。
最佳答案
这里您有三种选择来修复 VC UI:
首先: 您可以在代码或 strotyboard 中设置自动调整大小蒙版。
第二:使用didChangeStatusBarFrame:
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)newStatusBarFrame {
if ([UIApplication sharedApplication].statusBarFrame.size.height == 40) {
// Do adjustment
}
else if ([UIApplication sharedApplication].statusBarFrame.size.height == 20 && oldStatusBarHeight == 40){ // you should keep oldStatusBarHeight
// Do adjustment
}
else {
return;
}
}
第三:在 viewDidLoad
中注册 Change StatusBarFrame 通知:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameWillChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
并在 statusBarFrameWillChange
和 statusBarFrameChanged
中调整 VC 大小。
关于iphone - 由于 iPhone 中的默认调用,UI 受到干扰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17992099/