//
目的:用于
iOS7
和
iOS6
适配,和保留之前的坐标编码习惯,不用刻意加减
* 方法 1 :
*1 。在 vc 中重写 viewDidLayoutSubviews 方法
*2 。是用下面 2 个方法之一;
*3 。 frame 为 ios6 风格,状态栏和导航栏为平铺
*4 。 bounds 为 ios7 风格,状态栏和导航栏为覆盖
*5 。优点,所有 subview 的坐标都一 ios6 的标准进行编写,支持 push 和 present
*6 。缺点,在 push 中每个 vc 都需要重写 viewDidLayoutSubviews 方法;
*
void IOS7ToIOS6ofFrame( UIViewController *vc);
void IOS7ToIOS6ofBounds( UIViewController *vc);
* 方法 2:
*1. 在 vc 的 init 或 viewdidload 中使用 IOS7 宏即可;
*2. 状态栏和导航栏为平铺
*3. 优点:所有 subview 的坐标都一 ios6 的标准进行编写,支持 push ,背景 frame 值同 ios6
*4. 缺点:在 push 中每个 vc 都需要写,不支持 present ;
*
#define IOS7 if([[[[UIDevice currentDevice] systemVersion] substringToIndex: 1 ] intValue]>= 7 )\
{self.extendedLayoutIncludesOpaqueBars = NO;\
self.modalPresentationCapturesStatusBarAppearance =NO;\
self.edgesForExtendedLayout = UIRectEdgeNone;}
* 方法 3:
*1. 使用 self.navigationController.navigationBar.translucent =NO;
*2. 状态栏和导航栏为平铺
*3. 优点:所有 subview 的坐标都一 ios6 的标准进行编写,支持 push ,背景 frame 值同 ios6 ,只需要设置一次
*4. 缺点:必须有 nav ;对于 present 的 vc 必须为 nav
*
* 方法 4:
*1. 重新定义 CGRECT;
*2. 状态栏和导航栏为覆盖
*3. 优点:随时可以用
*
#define IsIOS7 ([[[[UIDevice currentDevice] systemVersion] substringToIndex: 1 ] intValue]>= 7 )
#define CGRECT_NO_NAV(x,y,w,h) CGRectMake((x), (y+(IsIOS7? 20 : 0 )), (w), (h))
#define CGRECT_HAVE_NAV(x,y,w,h) CGRectMake((x), (y+(IsIOS7? 64 : 0 )), (w), (h))
* 方法 1 :
*1 。在 vc 中重写 viewDidLayoutSubviews 方法
*2 。是用下面 2 个方法之一;
*3 。 frame 为 ios6 风格,状态栏和导航栏为平铺
*4 。 bounds 为 ios7 风格,状态栏和导航栏为覆盖
*5 。优点,所有 subview 的坐标都一 ios6 的标准进行编写,支持 push 和 present
*6 。缺点,在 push 中每个 vc 都需要重写 viewDidLayoutSubviews 方法;
*
void IOS7ToIOS6ofFrame( UIViewController *vc);
void IOS7ToIOS6ofBounds( UIViewController *vc);
* 方法 2:
*1. 在 vc 的 init 或 viewdidload 中使用 IOS7 宏即可;
*2. 状态栏和导航栏为平铺
*3. 优点:所有 subview 的坐标都一 ios6 的标准进行编写,支持 push ,背景 frame 值同 ios6
*4. 缺点:在 push 中每个 vc 都需要写,不支持 present ;
*
#define IOS7 if([[[[UIDevice currentDevice] systemVersion] substringToIndex: 1 ] intValue]>= 7 )\
{self.extendedLayoutIncludesOpaqueBars = NO;\
self.modalPresentationCapturesStatusBarAppearance =NO;\
self.edgesForExtendedLayout = UIRectEdgeNone;}
* 方法 3:
*1. 使用 self.navigationController.navigationBar.translucent =NO;
*2. 状态栏和导航栏为平铺
*3. 优点:所有 subview 的坐标都一 ios6 的标准进行编写,支持 push ,背景 frame 值同 ios6 ,只需要设置一次
*4. 缺点:必须有 nav ;对于 present 的 vc 必须为 nav
*
* 方法 4:
*1. 重新定义 CGRECT;
*2. 状态栏和导航栏为覆盖
*3. 优点:随时可以用
*
#define IsIOS7 ([[[[UIDevice currentDevice] systemVersion] substringToIndex: 1 ] intValue]>= 7 )
#define CGRECT_NO_NAV(x,y,w,h) CGRectMake((x), (y+(IsIOS7? 20 : 0 )), (w), (h))
#define CGRECT_HAVE_NAV(x,y,w,h) CGRectMake((x), (y+(IsIOS7? 64 : 0 )), (w), (h))