How to Prevent Dismissing Containing View Controller when Performing a Double-Tap on a UIPopoverController’s Background under iOS8 in Objective-C

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 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 post.

Posted in Cocoa, iOs, iPad, Mac, Objective-C, Xcode Tagged with: bugfix, iOs, iPad, popover
  • Swayambhu Jyoti Banerjee

    Can you post an equivalent Swift code for this. Thanks.

  • no, sorry. still waiting for my first swift project 🙂 but i’d be glad if you did it and sent the code to me! then i can share it here.