1,首先
1
2
3
4
5
6
7
8
9
|
//定义宏,判断ios7 #define
IOS7 [[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0 //添加代码 if (IOS7) { self .edgesForExtendedLayout
= UIRectEdgeNone; //视图控制器,四条边不指定 self .extendedLayoutIncludesOpaqueBars
= NO ; //不透明的操作栏<br>
self.modalPresentationCapturesStatusBarAppearance = NO; } |
#if
__IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 if (IOS7) { self .edgesForExtendedLayout
= UIRectEdgeNone; self .extendedLayoutIncludesOpaqueBars
= NO ; self .modalPresentationCapturesStatusBarAppearance
= NO ; //
self.automaticallyAdjustsScrollViewInsets = NO; //
self.navigationController.navigationBar.translucent = NO; //
self.tabBarController.tabBar.translucent = NO; } #endif |
self.automaticallyAdjustsScrollViewInsets = NO;
看这个UIViewController的这个属性你就明白了,此属性默认为YES,这样UIViewController下如果只有一个UIScollView或者其子类,那么会自动留出空白,让scollview滚动经过各种bar下面时能隐约看到内容。但是每个UIViewController只能有唯一一个UIScollView或者其子类,如果超过一个,需要将此属性设置为NO,自己去控制留白以及坐标问题。
http://blog.youkuaiyun.com/mac_cm/article/details/9234451,这个里面有一些属性介绍
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
这个是判断iphone5 or 4