当某些第三方应用程序(如Viber)显示红色录音状态栏时,我的iOS应用程序的视图稍微向下移动。这有点破坏了我的应用程序的界面。
是否有任何系统通知,我可以订阅得到通知,当这个栏显示?我能知道这个杆的高度吗?
你需要在状态栏发生变化时使用通知。
使用下面的代码来处理:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(change:)
name:UIApplicationWillChangeStatusBarFrameNotification
object:nil];
}
- (void)change:(NSNotification *)notificacion {
NSLog(@"%@", notificacion.userInfo);
}