Ios 6和ios7的適配

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 出現視圖看不到的情況

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章