[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didChangeStatusBarFrame:)
name:UIApplicationWillChangeS
#pragma mark - notif status bar
- (void)didChangeStatusBarFrame:(NSNotification *)notification
{
NSValue *statusBarFrameValue = [notification.userInfo valueForKey:UIApplicationStatusBarFrameUserInfoKey];
// TODO: react on changes of status bar height (e.g. incoming call, tethering, ...)
// NSLog(@"Status bar frame changed: %@", NSStringFromCGRect([statusBarFrameValue CGRectValue]));
}
模拟器中可以模拟这种情况,如下图: