iOS 来电 导致布局变化的解决方案
2015-11-01 15:56
609 查看
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusFrameChanged:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];在此监听获取到通知栏改变后的高度,对布局做相应改变
-(void) statusFrameChanged:(NSNotification*) note { CGRect statusBarFrame = [note.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue]; CGFloat statusHeight = statusBarFrame.size.height; UIScreen *screen = [UIScreen mainScreen]; CGRect viewRect = screen.bounds; viewRect.size.height -= statusHeight; viewRect.origin.y = statusHeight; self.view.frame = viewRect; [self.view setNeedsLayout]; }
相关文章推荐
- iOS关于RunLoop和Timer
- IOS中Socket的使用
- ios学习之苹果官方文档的学习(EKEventEditViewController)
- (NO.00002)iOS游戏精灵战争雏形(十)
- (NO.00002)iOS游戏精灵战争雏形(十)
- (NO.00002)iOS游戏精灵战争雏形(十)
- iOS触摸事件处理
- OC - 9.基于Quartz2D绘制下载进度条(demo)
- (NO.00002)iOS游戏精灵战争雏形(九)
- (NO.00002)iOS游戏精灵战争雏形(九)
- (NO.00002)iOS游戏精灵战争雏形(九)
- iOS 灰度发布的具体操作
- IOS轨迹文本的实现
- (NO.00002)iOS游戏精灵战争雏形(八)
- (NO.00002)iOS游戏精灵战争雏形(八)
- (NO.00002)iOS游戏精灵战争雏形(八)
- iOS: 从ipa提取图片资源文件及从iOS设备提取ipa文件的方法
- ios学习之苹果官方文档的学习(按钮点击事件方面)
- (NO.00002)iOS游戏精灵战争雏形(七)
- (NO.00002)iOS游戏精灵战争雏形(七)