下运行时受支持我有一个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