After presenting a modalviewController inside a navigationController, push and pop animations become corrupted

StackOverflow https://stackoverflow.com/questions/11290182

Pregunta

I have a normal NavigationController. When i open one modalView (using segues) and dismiss it, all the next push and pop animations from the NavigationController gets messy.

Basically it only animates the navigation bar, but the content of that view is not animated(to the left or to the right)!

details:

  1. NavigationController A pushes a viewController B.
  2. ViewController B shoes a modalView.
  3. ModelView is dismissed.
  4. User press back button in viewController B --> The animation to the left (to ViewController A) is not shown!

Does anyone knows what is going on?

Some code (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;
    }
}

Some code (3.):

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

    [self dismissModalViewControllerAnimated:YES];
}

Ok i have a clue: After the modal view appears and dismiss, all the other views that might disappear do not call "ViewWillDissapear". And this is probably what is killing the all thing..

¿Fue útil?

Solución

OK i Found the problem!

I had a tabbar subclassed. In my subclass i was doing this:

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

I changed to this:

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

And now every things seems to work properly!!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top