presentModalViewController - ViewController在呈现后自动消失
我目前正在为我的公司开发一个 iPhone 应用程序,我遇到了一件奇怪的事情。
我的视图层次结构如下所示:
UITabBarController 包含 5 个选项卡,每个选项卡都包含一个 UINAvigationController。 到目前为止一切都很完美。
现在我想通过 PresentModalViewController 方法呈现一个模式视图控制器 UITabBarController 使用以下代码行:
-(void)callFilterOptions
{
FilterOptionsView *filterView = [[FilterOptionsView alloc] init];
[filterView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.tabBarController presentModalViewController:filterView animated:TRUE];
}
FilterOptionsView 是一个普通的 UIViewController,只包含黑色背景 片刻。
所发生的情况是,视图呈现出来,几秒钟后就神秘地消失了。 为什么会发生这种情况?我在任何时候都不会调用missModalViewController 方法。
我在介绍邮件编辑器时已经遇到了这个问题。
问候, 弗洛里安
I am currently developing an iPhone App for my company and i ran into a strange thing.
My View Hierachy looks like this:
UITabBarController containing 5 Tabs with every Tab containing a UINAvigationController.
So far everything works perfect.
Now i want to present a modal View controller via the presentModalViewController method on the
UITabBarController using this lines of code:
-(void)callFilterOptions
{
FilterOptionsView *filterView = [[FilterOptionsView alloc] init];
[filterView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.tabBarController presentModalViewController:filterView animated:TRUE];
}
The FilterOptionsView is a normal UIViewController containing nothing but a black background at the
moment.
What happens is that the view is presented and after a couple of seconds misteriously disappears.
Why is this happening? At no Point i am calling the dismissModalViewController method.
I already ran into this problem when presenting a mailcomposer.
greetings,
Florian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或者更好的方法可能是:
驳回:
ps我建议不要将视图控制器命名为“filterView”,最好将其命名为“filterViewController”
or a better approach might be:
to dismiss:
p.s. I recommend not naming a view controller "filterView" it would be better named "filterViewController"