2012-12-15 62 views
1

我通過添加iPad.XIB並在源代碼編輯器模式下用IBIPadFramework替換IBCocoaTouchFramework,將我開發的xib轉換爲iPad特定的xib。不過我的意見沒有覆蓋全屏幕,很多空的空間周圍的意見,這些意見也解決不好,我需要做的比什麼我所提到的任何額外費用等..iPad的意見並未涵蓋整個屏幕?

編輯:

我爲iPad創建了新項目,工作正常,如果我在舊項目(iPhone)中爲iPad添加新xib,它不工作,是否有任何與我們需要更改的項目相關的項目?

謝謝。

+0

你是否在尺寸檢查器中設置了自動尺寸? – Atif

+1

是的Auto Resize子視圖也應該被選中,但是我正在考慮大小檢查器(Alt + Command + 5),您可以在其中設置視圖的大小和來源。 – Atif

+0

我做過了,仍然是同樣的問題。是否有可能這樣,或者我是否需要創建新的iPad xib,你有沒有試過這樣的? – Newbee

回答

2

如果出現小視圖,我認爲你的應用程序不支持iPad平臺,即它不是非反向應用程序。創建新的unversal應用程序並添加所有viewcontroller類和xib。 - 王子

1

您應檢查設備首先使用波紋管代碼,現在你創建兩個廈門國際銀行與同班一個XIB iPad和第二的iPhone與設備明智負荷..

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    { 
     //iphone 
    } 
    else 
    { 
     //ipad 
    } 

FOR EXAMPLE

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
    { 



     masterViewController = [[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPhone" bundle:nil]; 
     self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; 
     // loadingView =[LoadingView loadingViewInView:masterViewController.view:@"Please Wait.."]; 
     //masterViewController.view.userInteractionEnabled=NO; 




     [self.window makeKeyAndVisible]; 
     self.window.rootViewController = self.navigationController; 
     [self.window addSubview:self.navigationController.view]; 

     } 
    else 
    { 
     cntrMasterViewController *masterViewController = [[[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPad" bundle:nil] autorelease]; 
     self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController]; 


     UIViewController *viewController1 = [[cntrMasterViewController alloc] initWithNibName:@"cntrMasterViewController_iPad" bundle:nil]; 

      [self.window makeKeyAndVisible]; 
      self.window.rootViewController = self.navigationController; 
     [self.window addSubview:self.viewController1.view]; 

} 
+0

那麼,我們不能將iPhone xib轉換成iPad嗎?因爲每個xib都有很多連接,所以我必須再做一次。 – Newbee

+0

我實際上並不確定iPhone xib是否可以在ipad xib中轉換,但我喜歡上面的方法 –

+0

無論如何謝謝,這將對我的新視圖有用:) – Newbee

1

你必須再次設置你的視圖的子視圖框架,使它們看起來適合iPad屏幕。做到在iPad上的廈門國際銀行或programmaticaly,根據你在

0

是什麼設備就檢查xib名字你把正確使用尼廷的方法來加載視圖

yourViewController = [[yourViewController alloc] initWithNibName:@"yourIpadNibName" bundle:nil]; 

只專注於yourIpadNibName