首页 文章

在navigationController中呈现modalviewController后,推送和弹出动画会损坏

提问于
浏览
1

我有一个普通的NavigationController . 当我打开一个modalView(使用segues)并将其关闭时,来自NavigationController的所有下一个push和pop动画都会变得混乱 .

基本上它只会动画导航栏,但该视图的内容不是动画的(向左或向右)!

细节:

  • NavigationController A推送一个viewController B.

  • ViewController B鞋一个modalView .

  • ModelView被驳回 .

  • 用户在viewController B中按下后退按钮 - >左边的动画(到ViewController A)没有显示!

有谁知道发生了什么事?

一些代码(2.show modal):

- (void)sendFilesDidPick:(SendFilesType)type{
    switch (type) {
        case Library:
            if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
                UIImagePickerController *picker = [[UIImagePickerController alloc] init];
                picker.delegate = self;

                picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
            picker.allowsEditing = YES;
            [self presentModalViewController:picker animated:YES];
        }else {
            ////TODO: Tell user not available
        }
        break;
    default:
        break;
    }
}

一些代码(3.):

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

    [self dismissModalViewControllerAnimated:YES];
}

好吧我有一个线索:在模态视图出现和解除后,所有其他可能消失的视图不会调用“ViewWillDissapear” . 这可能就是杀死所有东西的原因 .

1 回答

  • 2

    好的我发现了问题!

    我有一个tabbar子类 . 在我的子类中,我这样做:

    - (void)viewDidAppear:(BOOL)animated {
         //Custom code
    }
    

    我改为:

    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        //Custom code
    }
    

    现在每件事似乎都能正常运作!!

相关问题