码迷,mamicode.com
首页 > 移动开发 > 详细

Ios 6和ios7的适配

时间:2015-04-28 11:57:19      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:ios   ios 适配   

Ios 6ios7的适配

1.普通的 ViewController:view的显示从状态栏下面开始,只需在viewDidLayoutSubviews调整 viewbounds        

CGRect bounds = self.view.bounds;

  bounds.origin.y =  - [self.topLayoutGuide length];

self.view.bounds = bounds;

 

2.ScrollView 类型的 在viewDidLoad 里面加:

if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {

        self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0);

}

 

3.有导航控制器的普通ViewController:viewDidLoad里面加

#ifdef __IPHONE_7_0

    if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {

        self.edgesForExtendedLayout = UIRectEdgeNone;

    }

#endif

 

4.有导航控制器的UITableViewController不用适配,他会自动在导航控制器的下面

 

5.有选项卡的ViewController:ViewDidLoad里面加:

#ifdef __IPHONE_7_0

    if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {

        self.edgesForExtendedLayout = UIRectEdgeNone;

    }

#endif

 

6.有选项卡的UITableViewControllerViewDidLoad里面加:

#ifdef __IPHONE_7_0

    if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {

        self.edgesForExtendedLayout = UIRectEdgeNone;

        self.tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0);

    }

#endif

 

7.有导航控制器和有选项卡的UITableViewController不用适配,他会自动在2者的中间

8.有导航控制器和有选项卡的ViewController不用适配,他会自动在2者的中间

 

 

 

 

 

 

Ios6 ios7屏幕翻转

1.在UIViewController里面添加

- (BOOL)shouldAutorotate{

    return YES;

}

 

- (NSUInteger)supportedInterfaceOrientations{

    return UIInterfaceOrientationMaskPortraitUpsideDown;

}

 

设置方向后不是真正显示的UIViewController  presentViewController 出现视图看不到的情况

Ios 6和ios7的适配

标签:ios   ios 适配   

原文地址:http://blog.csdn.net/zhangping871/article/details/45332025

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!