【发布时间】:2014-02-26 23:19:21
【问题描述】:
我有一个带有行的 UITableView,当您单击每一行时,您将看到详细信息视图,我想要这个用于 iPhone, 如果我旋转设备并从列表中选择我的行,我必须查看描述。(我的意思是在左边我必须有我的行,在右边我的详细视图)将设备旋转回垂直并隐藏详细视图.
我使用了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'
【问题讨论】:
标签: ios objective-c uitableview uisplitviewcontroller landscape