2014-10-18 82 views
-1

兼容我有廈門國際銀行項目(消息應用程序),所以它支持(iPhone 4 + 5分+ 5秒)如何使應用程序的意見與iPhone 6和6加

,我想在iPhone 6和6加

配伍

所以我創建新的文件,廈門國際銀行,現在我有5個XIB文件是這樣的:

MainViewController.xib

MainViewController_568.xib

MainViewContro ller_667.xib

MainViewController_736.xib

所以,當我想通過按鈕可以從視圖轉移到另一個我把這個順序: -

- (IBAction)MainViewController:(UIButton *)sender { 
    MainViewController *YourApp = [[MainViewController alloc] init]; 
    if (self.view.bounds.size.height >= 667) 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_667" bundle:nil]; 
    else 
    if (self.view.bounds.size.height >= 568) 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_568" bundle:nil]; 
    else 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil]; 

    //favController.parent = self; 
    [self presentModalViewController:YourApp animated:NO]; 
    [YourApp release]; 
    //PP_RELEASE(YourApp); 
} 

,但它沒有響應。

+0

蘋果已經提供了自動佈局是使用 – Leena 2014-10-18 12:44:48

回答

-1

請使用此代碼

- (IBAction)MainViewController:(UIButton *)sender { 
MainViewController *YourApp = [[MainViewController alloc] init]; 
if (self.view.bounds.size.height == 736) 
    YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_736" bundle:nil]; 
else if (self.view.bounds.size.height == 667) 
    YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_667" bundle:nil]; 
else if (self.view.bounds.size.height == 568) 
    YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_568" bundle:nil]; 
else 
    YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil]; 

//favController.parent = self; 
[self presentModalViewController:YourApp animated:NO]; 
[YourApp release]; 
//PP_RELEASE(YourApp); 

}

-1

試試這個代碼,它可以幫助你

- (IBAction)MainViewController:(UIButton *)sender 
{ 
    MainViewController *YourApp = [[MainViewController alloc] init]; 
    if ([UIScreen mainScreen].bounds.size.height == 736) 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_736" bundle:nil]; 
    else if ([UIScreen mainScreen].bounds.size.height == 667) 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_667" bundle:nil]; 
    else if ([UIScreen mainScreen].bounds.size.height == 568) 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController_568" bundle:nil]; 
    else 
     YourApp = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil]; 

    //favController.parent = self; 
    [self presentModalViewController:YourApp animated:NO]; 
    [YourApp release]; 
    //PP_RELEASE(YourApp); 
} 
相關問題