I have a custom view in a .xib file, which I use as the contentViewController
for an MAAttachedWindow
. The view has several NSTextField
s in it.
When I open the MAAttachedWindow
first time, everything is fine. Text shows up in all relevant text fields. Then, if I close the window (which sets it to nil
) and then call it again (which reinitializes, using the same custom view as the contentViewController
), the last firstResponder
text field is now blank.
The strange thing is that if I click the "empty" text field, it shows the correct text. This can be edited, and behaves appropriately as long as this text field has focus. As soon as something else becomes firstResponder
, the text vanishes again.
Updates:
NSSecureTextField
s.I got it!
I simply needed to explicitly remove the viewController
from its superview
before closing (and subsequently deallocating) the MAAttachedWindow
.