What to do if a custom modal sheet doesn’t get presented modally the first time it is called

This isn’t in the documentation anywhere, although to be fair the documentation is in even more of a mess than it ever was before, and despite the fact that the old methods are all deprecated, the guide for presenting window sheets in Cocoa still seems to be stuck in the 10.1 era.

Problem: I am trying to present a custom panel as a modal sheet attached to my main window. The first time the panel is called, it appears as an individual window, unattached to the window from which the panel was presented, and does not behave modally. The second time it is called, it displays normally.

Solution: in Interface Builder, select the window you are using as your custom panel and uncheck “Visible at Launch”.

Leave a Reply

Your email address will not be published. Required fields are marked *