views:

518

answers:

2

Hi all,

I am creating a sample application for Mac OSX. I created a window which contains a login button and I added a new custom view. Now I need to load the custom view to the window when the user clicks the login button. Please anyone help me...

+2  A: 

Will this help?:

[[window contentView] addSubview:customView];

Diederik Hoogenboom
You will likely also need to call setFrame: on the custom view so that it's placed correctly in the window.
Alex
+1  A: 

[window setContentView:customView] will also do the job.

You also need to add IBOutlet variables for your window and custom view to the header file for your controller, and drag that onto the Interface Builder document window. Then control drag from the controller to the window and view, and select the variables.

(and you need to change the controller to be an instance of your custom controller class, which you do by selecting it in Interface Builder and going to the Inspector)

grahamparks