So, any clue on this? I had to use [self dismiss modalviewcontroller to dismiss modalviews. Funny fact: when dismissing a tabbarcontroller I could still use the reference to parentviewcontroller, when dismissing a regular viewcontroller, not.
On iOS 5 you will need to use the presentingViewController
selector instead of the parentViewController
selector.
-(UIViewController *)getParentViewController{
float currentVersion = 5.0;
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (sysVersion >= currentVersion) {
// iOS 5.0 or later version of iOS specific functionality hanled here
return self.presentingViewController;
}
else {
//Previous than iOS 5.0 specific functionality
return self.parentViewController;
}
}
The app i have in the store was built using ios SDK 4.3 and uses self.parentViewController dismissModalViewControllerAnimated:YES
. It continues to work with IOS 5 devices. I thought it would since it was built on sdk 4.3. Now when i'm updating it with the new xcode and ios 5.0 sdk, it will not work as is and i have to change all the view closing stuff to use the conditional selector workaround mentioned above.(yuck!)
Just thought i'd mention that dismissing from the parent should work on ios 5 (at least in my case with the ios 4.3 sdk). I can't speak for previous sdks or other selectors with parentViewController.
I have built a category that add presentingViewController
on iOS 4.
It disables itself on iOS 5.
You can use it seamlessly. Please see backward-modal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With