dismissModalViewControllerAnimated not working on parentViewController


However self.parentViewController not working is in fact new to iOS 5. It has been ‘replaced’ with self.presentingViewController.
This causes an interesting problem for code trying to be pre-iOS 5 compatible. Since as you have foundself.parentViewController returns nil on iOS 5. And UIViewControllers do not respond topresentingViewController pre-iOS 5.

It leaves us doing something like this:

if ([self respondsToSelector:@selector(presentingViewController)])
{
    [self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else 
{
    [self.parentViewController dismissModalViewControllerAnimated:YES];
}

dismissModalViewControllerAnimated not working on parentViewController dismissModalViewControllerAnimated not working on parentViewController Reviewed by Ricardo Castellanos on 12:24 Rating: 5

No hay comentarios:

Con la tecnología de Blogger.