在导航控制器中呈现模态视图控制器后,推送和弹出动画会损坏



我有一个普通的导航控制器。当我打开一个模态视图(使用 segue)并关闭它时,导航控制器中的所有下一个推送和弹出动画都会变得混乱。

基本上它只对导航栏进行动画处理,但该视图的内容没有动画(向左或向右)!

详:

  1. 导航控制器 A 推送视图控制器 B。
  2. 视图控制器 B 鞋一个模态视图。
  3. 模型视图被关闭。
  4. 用户在视图控制器 B 中按后退按钮 --> 左侧的动画(到视图控制器 A)未显示!

有谁知道发生了什么?

一些代码(2.显示模态):

- (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"。这可能就是杀死一切的原因。

好的,我发现了问题!

我有一个标签栏子类。在我的子类中,我这样做:

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

我改成这个:

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

现在一切似乎都正常工作!!

最新更新