Panel will not show again after 1st time


#1

My preferences panel loads and shows correctly, after I choose “Preferences” from the menu. However, after closing the panel and trying to launch it a second time, it does not show. The line in AppController’s showPreferencePanel: method still works:NSLog(@"showing %@", preferenceController) I see the same object’s memory address logged, but the panel never shows after the first time I close it.

Any idea what’s going on? Thanks.


#2

I found a hint, that led me to finding where I went wrong, on Stack Overflow: http://is.gd/o06BJ9. It read as follows: “Turned out the window was not connected in IB. Another lesson in looking for the obvious solution first.”

I thought the author of that comment could have been more clear. Anyway, here’s what I found. At the bottom of page 191, it reads as follows: “Control-click File’s Owner to get the connection window. Connect the window outlet to the panel (Figure 12.12).”

Figure 12.12 is on the next page (192), so maybe I missed it. If you connect File’s Owner’s window outlet to the actual panel, everything will work as intended! You can Control-click on File’s Owner and then drag to either the icon that represents the panel, or to the actual panel that you dragged on screen earlier. Save and build, and then run. All is then well.