storyboard navigation项目链接到uiviewcontroller

时间:2012-02-24 13:42:03

标签: xcode4

我创建了一个拆分视图项目,在iPhone的故事板上,我将一个条形按钮项拖到右侧导航并更改样式添加,然后我将一个视图控制器拖到故事板上,所以我使用control-drag来构建链接,并更改uiviewcontroller的自定义类“AddViewController”,当我运行项目并推送DetailViewController时,它是黑色视图。

我在AddViewController.m上输入了代码

-(void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"        bundle:nil];
    UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"AddViewController"];
    [vc setModalPresentationStyle:UIModalPresentationCurrentContext];
    [self presentModalViewController:vc animated:YES];
}

1 个答案:

答案 0 :(得分:0)

我找到了原因 在我的创建“AddCreateViewController”上,我应该评论该函数。

- (void)loadView
{
    // If you create your views manually, you MUST override this method and use it to create your views.
    // If you use Interface Builder to create your views, then you must NOT override this method.
}