下運行時受支持我有一個UITableView,帶有行,當你點擊每一行時,你將看到詳細視圖,我想要這個iPhone, 如果我旋轉設備並選擇我的(我的意思是在左邊,我必須有我的行,並在我的詳細信息視圖中)將設備旋轉回垂直並隱藏細節視圖。iPhone'UISplitViewController僅在UIUserInterfaceIdiomPad'
我用splitViewController,但我有一個錯誤,你會請我的代碼,讓我知道這裏有什麼問題?
在此先感謝!
下面是代碼
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
ViewController *view = [[ViewController alloc] initWithNibName:@"ViewController"
bundle:nil];
_nav = [[UINavigationController alloc] initWithRootViewController:view];
//
MattersDetailView *detailVC = [[MattersDetailView alloc] initWithNibName:@"MattersDetailView"
bundle:nil];
_nav = [[UINavigationController alloc] initWithRootViewController:detailVC];
[[UINavigationBar appearance] setBarTintColor:[self colorWithHexString:@"ecd555"] ];
splitViewController =[[UISplitViewController alloc] init];
splitViewController.viewControllers = @[view,detailVC];
self.window.rootViewController = splitViewController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
,再加入此方法的viewController都.m文件
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
但我有這個錯誤
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'UISplitViewController is only supported when running under UIUserInterfaceIdiomPad'
謝謝你的回覆,你知道我怎麼能在iPhone上做到這一點? – user3273254
如何做?請明確點。 – rmaddy
當我以橫向模式旋轉iPhone時,在iPhone中同時具有表格列表和詳細視圖 – user3273254