2011-12-29 1 views
0

유니버설 앱 (iPhone 및 iPad)을 작업하고 있습니다. 설정보기를 표시해야하는 버튼이 있고 iPad 용으로 하나, iPhone 용으로 두 개의 별도 XIB 파일이 있습니다. 다음 코드가 있습니다 :iPhone에서로드시 빈 화면이 표시됩니다.

settingsView* sv=[[settingsView alloc]initWithNibName:@"settingsView" bundle:nil]; 
settingsView* isv=[[settingsView alloc]initWithNibName:@"settingsView_iPad" bundle:nil]; 

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

    [self presentModalViewController:sv animated:YES]; 
    NSLog(@"I am an iPhone"); 

} 

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

    [self presentModalViewController:isv animated:YES]; 
    NSLog(@"I am an iPad"); 
} 

이 코드는 상태 표시 줄이 맨 위에 검은 색 화면으로 표시됩니다. 나는 이유를 모른다. 어떤 도움이라도 대단히 감사하겠습니다. 감사합니다

,

허시 K. Bhargava

답변

0

,이 문제가 해결 드래그 앤 Class.xib 파일에 빈 두 UIViewController에 드롭하는 가장 좋은 방법. 두 개의 @property (nonatomic, retain) ClassAVC 및 @property (nonatomic, retain) ClassBVC를 만들고 비어있는 UIViewController의 연결을 class.xib 파일로 가져오고 NIB 이름을 settingsView 및 settingsView_ipad nib 파일 이름으로 변경합니다. 그런 다음

[self presentModalViewController:ClassAVC animated:YES]; 
    [self presentModalViewController:ClassBVC animated:YES]; 

뿐만 아니라

[self.navigationController pushViewController:ClassAVC animated:YES]; 
    [self.navigationController pushViewController:ClassBVC animated:YES]; 
시도