【发布时间】:2012-02-19 13:26:23
【问题描述】:
我有一个客户想要自定义标签栏的大型项目。我选择 BCTabBarController 来代替 UITabbarController。经过几次修复后它工作正常,但经过测试我发现了一个错误:
ViewWillAppear, ViewDidAppear, ViewWillDisappear ViewDidDisappear methods not called in selectded view controller and not called into BCTabBarController.
This problem appears after BCTabBarController show modal controller from instance of BCTabBarController class.
我有 posted issue to github repo 的 briancolins,但仍然没有答案。
这里有一些我调用当前模态视图控制器的代码:
- (void) presentProperlyModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
{
if ([[self controllerToPresentModalFrom] respondsToSelector:@selector(presentViewController:animated:completion:)]) // For iOS 5
{
[[self controllerToPresentModalFrom] presentViewController:modalViewController animated:animated completion:^(){}];
}
else
{
[[self controllerToPresentModalFrom] presentModalViewController:modalViewController animated:animated];
}
}
-(void) dismissProperlyModalViewControllerAnimated:(BOOL)animated
{
if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)]) {
[self dismissViewControllerAnimated:animated completion:^(){}];
}
else
{
[self dismissModalViewControllerAnimated:YES];
}
}
更新:此问题未在 iOS5 中重现,但在 iOS 4.3 中存在
【问题讨论】:
标签: objective-c ios ios4 uitabbarcontroller