presentViewController - 查看纯黑色,未调用viewDid___方法

Thr*_*dyn 5 xcode objective-c modalviewcontroller

    ...
    SecondViewController *svc = [SecondViewController new];
    [self presentViewController:svc animated:YES completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)

这段代码与我在另一个应用程序中使用的代码完全相同,但在这里我使用presentViewController而不是presentModalViewController
(completion:NULL使它们实际上相同.至少相同的结果.)

创建模态视图的两种尝试都以相同的方式构建.主视图中的那些行,Storyboard中的视图控制器以及匹配.h.m文件.唯一的区别是,在这里我想要一个程序化的触发器,因此不可能拖动一个segue并完成它.
我有一个对象设置来识别手势并调用转换方法.这可能是造成问题的原因(至少是其中的一部分),但这是必要的.

使用UIButton会作弊.没有截止日期,没有捷径.

编辑: NSLog输出显示奇怪的东西.

2012-04-05 10:41:12.047 MyApp[5962:707] <SecondViewController: 0x1d8c130>
2012-04-05 10:41:12.479 MyApp[5962:707] <SecondViewController: 0x1d8e360>

所以我再做一些愚蠢的事情,碰巧有一个非常简单的修复,对吧?
再次编辑:presentViewController…不止一次被调用.固定它.不过还是黑的.


回到performSegueWithIdentifier:sender:而不是更容易presentViewController:animated:completion:

由于未捕获的异常"NSInvalidArgumentException"而终止应用程序,原因:'Receiver ...没有带标识符的segue ......'

我告诉它要执行一个segue,但是在Storyboard中没有一个(我不能添加一个,'Connections inspector'下面没有Storyboard Segues部分,我试图使用的对象),所以它崩溃了.这是正常行为.

我想要的是有一个模态视图而不需要创建一个segue.我已经完成了,所以我知道这是可能的.
我所需要的只是帮助它发挥作用.

.

performSegueWithIdentifier:@"Identifier" sender:nil NSSInvalidArgumentException
presentViewController:viewController animated:YES completion:NULL 空视图

Thr*_*dyn 12

得到它了.

用以下代码替换问题中的行:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard"
                                                     bundle:nil];
SecondViewController *viewController =
            [storyboard instantiateViewControllerWithIdentifier:@"SecondView"];
[self presentViewController:svc animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud)

感谢这个解决方案转到IturPablo的自我回答的问题:
TabBarController,覆盖shouldSelectViewController做一个segue