0

嗨,我是 IOS 开发和开发 IOS 应用程序的新手,我在其中使用拆分视图控制器。我的拆分视图控制器不在根位置。我先登录然后打开拆分视图控制器。所以我在用户登录成功后所做的我正在更改根视图控制器。这是我到目前为止所做的:

在登录按钮单击时,我将根视图控制器更改为像这样的拆分视图控制器

- (IBAction)signinAction:(id)sender
{
    NSLog(@"inside sign in .... ");
    AppDelegate *delegate =  [[UIApplication sharedApplication] delegate];
    delegate.window.rootViewController = [[UserProfileController alloc] init];
    [self dismissViewControllerAnimated:YES completion:nil];
}

用户配置文件是我拆分视图的详细视图控制器。

@interface UserProfileController : UIViewController<UISplitViewControllerDelegate>

@end

但点击登录按钮后,它会打开黑色窗口。不知道怎么回事。难道我做错了什么?需要帮助谢谢。

4

1 回答 1

0

首先你应该 在你的第一个控制器和拆分视图控制器之间不建立任何连接之后将你的 id 更改UISplitViewController为。Split然后在代码中使用以下代码切换到它:

- (IBAction)signinAction:(id)sender

{   
UISplitViewController *split = [self.storyboard instantiateViewControllerWithIdentifier:@"Split"];
self.view.window.rootViewController = split;
} 
于 2014-05-02T10:32:51.317 回答