UIViewController+PresentingViewController
I was very annoyed with the problem that iOS 4 does not support self.presentingViewController
.
And that makes my code look bad when trying to dismiss a modal view.
This library allow you to use self.presentingViewController
on iOS 4. (On iOS 5, it disables itself. So, no worry)
I hope it benefits you as much as it does to me.
For more information about the technique, please see my blog here
How to use it
Include 2 files into your project:
UIViewController+PresentingViewController.h
UIViewController+PresentingViewController.m
That's it.
On iOS 4, you may use self.presentingViewController
.
On iOS 5, the files are disabled by themselves. So, don't worry about it.
How to test it
- Clone the project (or Download as a zip file)
- Run the project under iPhone 4.x simulator
- Run the project under iPhone 5.x simulator to see that it works on both iOS
Author
Tanin Na Nakorn
License
Do What The Fuck You Want To Public License (http://sam.zoy.org/wtfpl/)
- You just DO WHAT THE FUCK YOU WANT TO.