因此,此应用程序的 rootViewController
是 UITabBarController
子类。我们遇到了一个奇怪的问题,如果我们将 NO
传递给动画,我们就无法将 UITabBarController
获取到 -presentModalViewController:animated:
。我们尝试了多种方法:-viewDidLoad
、-viewWillAppear
、-viewDidAppear
,并且只有在之后执行才能使其正常工作延迟,这很糟糕。
我决定将其分解为一个测试,发现如果我有一个在 -viewDidAppear
中调用 -presentModalViewController:animated:
的 UIViewController
code> 方法,它与 animated
参数的 YES
和 NO
一起按预期工作。但是,如果此 VC 是 UITabBarController
,则当 animated
为 YES
时,它可以工作,但如果为 NO
,则不起作用。
有什么想法吗?这是一个错误吗?我在网上和文档中进行了搜索,但找不到 UITabBarController 不能以这种方式呈现 View 的原因。
最佳答案
这听起来确实像是一个错误。我建议您提交 bugreport与苹果。如果它阻止了你的项目,你可以通过 Apple 的一个支持事件提交它,如果他们发现这确实是一个错误,他们将退还该支持事件的费用(这样你就不会失去任何东西)。如果不是错误,他们将为您提供解决方案。
关于objective-c - 使用-presentModalViewController :animated: with UITabBarController NOT animated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6601113/