The last commit broke the code for non-modal view controllers. This handles that and has code for iOS 4, though it's untested.