22 Mar 2012
Here is one annoying problem.
In iOS 4, when I want to dismiss a modal view, I would:
But that doesn't work on iOS 5 anymore.
On iOS 5, I have to use
`self.presentingViewController` instead, but iOS 4 does not support the property.
So, what do we do now?
I have decided to build a hook, which is an Objective-C category with 2 fake properties, namely
Moreover, I chain the method
and ``dismissModalViewControllerAnimated:``` in order to set/unset those properties.
By the way, these types of technique are so common in Ruby.
Walla! iOS 4 magically supports
`self.presentingViewController`. You really don't need to do anything but including 2 files into your project. The files are:
You may grab the source code at UIViewController+PresentingViewController.