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

时间:2012-07-02 08:30:54

标签: ios iphone objective-c uinavigationcontroller modal-view

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

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

详细信息:

  1. NavigationController A推送一个viewController B。
  2. ViewController B穿上modalView。
  3. ModelView被驳回。
  4. 用户在viewController B中按下后退按钮 - >左边的动画(到ViewController A)没有显示!
  5. 有谁知道发生了什么事?

    一些代码(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 个答案:

答案 0 :(得分:2)

好的我发现了问题!

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

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

我改为:

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

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