- (void)handleUIApplicationWillChangeStatusBarFrameNotification:(NSNotification *)notification
{
CGRect rect = self.tabBarBgView.frame;
NSLog(@"======%@",NSStringFromCGRect(rect));
if (IS_HOTSPOT_CONNECTED == YES) {
rect.origin.y = WF_ScreenHeight-49-20;
self.tabBarBgView.frame =rect;
}else{
rect.origin.y = WF_ScreenHeight-49;
self.tabBarBgView.frame =rect;
}
[self updateFrame];
}
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:UIApplicationWillChangeStatusBarFrameNotification];
}
- (void)showTabbar
{
self.tabBarBgView.hidden = NO;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUIApplicationWillChangeStatusBarFrameNotification:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
}
在我们的pch文件里面宏定义
#define SYS_STATUSBAR_HEIGHT 20
// 热点栏高度
#define HOTSPOT_STATUSBAR_HEIGHT 20
// APP_STATUSBAR_HEIGHT=SYS_STATUSBAR_HEIGHT+[HOTSPOT_STATUSBAR_HEIGHT]
#define APP_STATUSBAR_HEIGHT (CGRectGetHeight([UIApplication sharedApplication].statusBarFrame))
// 根据APP_STATUSBAR_HEIGHT判断是否存在热点栏
#define IS_HOTSPOT_CONNECTED APP_STATUSBAR_HEIGHT==(SYS_STATUSBAR_HEIGHT+HOTSPOT_STATUSBAR_HEIGHT)?YES:NO
ok完美