When opening up a popover from a modal view (or another popover) on an iPad running iOS 8 and double-tapping on the background of the popover, not only the popover will be dismissed but also the modal view. This behavior was non-existant in iOS 7 and seems to be a bug in iOS 8.

Luckily, someone over at objc.io presented a fix for that problem in this post. However, the focus of this post lies on extensive Objective-C debugging and the actual fix is presented rather shortly.

Therefore, I have created an Xcode project exemplifying the bugfix. If you download and start this Xcode project on an iPad simulator using iOS 8, tap ‘Open Modal View 1’, tap ‘Open Popover’ and then double-tap on the background of the opened popover, you will see this erroneous behavior that closes both view controllers. If you instead start the project on an iPad simulator using iOS 7, the behavior will be correct closing only the popover.

The final fix can be found in this Xcode project. There, the popover inherits from PreventDoubleTapRemoveViewController, which suppresses the erroneous behavior using the fix explained in the objc.io post.

Published by Johannes Luderschmidt

About this blog