2011-12-14 51 views
0

我正在通用稱謂。它有一個表格視圖。如果用戶點擊表格單元格,並且用戶選擇了iPad,則必須轉到另一個專爲iPad設計的視圖。我怎樣才能使它成爲可能?我做如下:通用應用程序中的iPad視圖

TwitterDetailViewController *detailViewController = [[TwitterDetailViewController alloc] initWithNibName:@"TwitterDetailViewController" bundle:nil]; 

    detailViewController.detaildict= Detaildict; 

    [self.navigationController pushViewController:detailViewController animated:YES]; 
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    { 
     iPadView *iPadview = [[iPadView alloc] initWithNibName:@"iPadView" bundle:nil]; 
     [self.navigationController pushViewController:iPadview animated:YES]; 
    } 
+0

detailViewController應該是全推或只在iPhone的情況下? – alinoz

回答

-1

只是拿旗的iPhone和iPad。然後

detailViewController.detaildict= Detaildict; 

[self.navigationController pushViewController:detailViewController animated:YES]; 

if("check here with flag") or else if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) 
{ 
iPadView *iPadview = [[iPadView alloc] initWithNibName:@"iPadView" bundle:nil]; 
[self.navigationController pushViewController:iPadview animated:YES]; 
} 

我希望它能工作!

-1

在didSelectRowAtIndexPath方法檢查狀態像下面

TwitterDetailViewController *Twitter_obj ; 
    if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) 
    { 
     Twitter_obj = [[TwitterDetailViewController alloc] initWithNibName:@"TwitterDetailViewController-ipad" bundle:nil];//iPad nib 
    } 
    else 
    { 
     Twitter_obj = [[TwitterDetailViewController alloc] initWithNibName:@"TwitterDetailViewController" bundle:nil];//iPhone nib 
    } 
    self.navigationController pushViewController:Twitter_obj animated:YES]; 
    [Twitter_obj release]; 
相關問題