I have an NSView inside my project’s window as seen in the picture below:

How do I add NSImageViews to the subview of this ‘Custom View’ so its displayed in there rather than directly in the main window of the application?
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.
Programmatically, you would access the view to which you want to add subviews, then call the -addSubView: method on it. You can access it either as an IBOutlet hooked in to interface builder, or access it by Identifier (set the Identifier string in the “identity” section in the interface builder inspector). Iterate through the subviews of the windowcontroller’s view (your custom view would be one) and test the string value of “identifier”
Here’s a simplified code snippet from a recent project for programmatically adding an extra “properties” box into a view that already has a box defined in the xib. I’m adding a new box view (
propertiesBoxView) into an existingNSView(referenced by the IBOutlet-ed_detailsView) and positioning it relative to another sibling box (with its identifier set to “UI_DETAILSBOX”). An NSImageView should behave the same way as a box view: