Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 视图将显示在BCTabBarController中未调用_Objective C_Ios_Ios4_Uitabbarcontroller - Fatal编程技术网

Objective c 视图将显示在BCTabBarController中未调用

Objective c 视图将显示在BCTabBarController中未调用,objective-c,ios,ios4,uitabbarcontroller,Objective C,Ios,Ios4,Uitabbarcontroller,我有一个大项目,客户希望的自定义选项卡栏。我选择了BCTabBarController来代替UITabbarController。经过几次修复后,它工作正常,但经过测试,我发现了一个错误: ViewWillAppear, ViewDidAppear, ViewWillDisappear ViewDidDisappear methods not called in selectded view controller and not called into BCTabBarController. T

我有一个大项目,客户希望的自定义选项卡栏。我选择了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.
我对布里安科林斯的事已经说过了,但仍然没有答案

下面是我调用当前模式视图控制器的一些代码:

    - (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中出现,如您所述。iOS 5转发消息,而以前的版本不转发。以下是我如何处理类似情况:

- (BOOL)needsMessageForwarding:(UIViewController *)vc {
    if ( [vc isKindOfClass:[UINavigationController class]] == NO)
        return YES;

    NSString *ver = [UIDevice currentDevice].systemVersion;
    if ( [ver characterAtIndex:0 < '5'] )
        return YES;

    return NO;
}

- (void) viewWillAppear:(BOOL)animated {
    ...
    if ( [self needsMessageForwarding:modalViewController] )
        [modalViewController viewWillAppear:animated];
    ...
}

// repeat pattern in the other viewWill... viewDid... functions.
-(BOOL)需要消息转发:(UIViewController*)vc{
if([vc isKindOfClass:[UINavigationController类]]==否)
返回YES;
NSString*ver=[UIDevice currentDevice].systemVersion;
如果([ver characterAtIndex:0<'5']))
返回YES;
返回否;
}
-(无效)视图将显示:(BOOL)动画{
...
if([self-needsMessageForwarding:modalViewController])
[modalViewController视图将显示:动画];
...
}
//在另一个视图中重复图案将。。。我做过。。。功能。

在我的情况下,我有一个可以看到的视图控制器列表,所以我管理哪个视图控制器是可见的,并将消息转发给它。

我已经弄明白了。这是BCTabBarController中的一个bug。存在childViewController阵列。如果已呈现-viewwillAppear不会发送。谢谢!我使用的是响应选择器