Using IB, I have dropped an NSView (menuView) inside another.
I have set up my outlet and connected it to menuView.
I thought: ” [self.menuView setHidden:NO] ” would unhide it but it seems not to be working.
What else do I have to do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s call the object with the connected outlet Fred.
You instantiated Fred in the nib, right?
And you have Fred loading the nib, right?
If the answer to either of those two questions was “no”, then disregard this answer.
If the answer to both of them was “yes”, then continue reading.
That’s wrong. Fred should do only one of these two things. Chances are, you meant to make Fred the File’s Owner, and hook up the connection there. The extra Fred you created in the nib is just that—an extra Fred, second to the Fred that loaded the nib. You have two Freds, and the one you have reporting the connection (in response to an action message, I’m guessing) is not the one whose outlet you connected to the menu view.
Kill off the Fred in the nib, leaving only the Fred that loads the nib. In the nib, declare the File’s Owner as being of Fred’s class, and in Fred’s implementation, make sure that you are the File’s Owner when you load the nib.
If you’re using NSWindowController to load it, you need to pass yourself as owner explicitly; otherwise, the NSWindowController is the owner. Since you want Fred to be the owner, you need to tell the window controller that when you instantiate it. The alternative is to use NSBundle to load the nib directly, without an intervening window controller.