The basic concepts in this are below:
- The starting point is same as iOS application. i.e. File -> New Project , select the Mac OS X and Cocoa Application.
- Save the project and just run it => It shows up the Empty Mac application.
- the difference between iOS and Mac application is that the window is fully resizable.
- Mac application can have more than one window, and can be minimised etc.
The empty view that shows up when it is run is a Window.
Now it is time to add views to it. This can be done in the below way. Inorder to do this, File / New File and give name something like FirstAppViewController.
If the Controller is created with a xib file associated with it, then the components can be just dragged to the xib file
Even though now we created a new Cotnroller, it doesn't get added to the window automatically. Code like below needs to be added to the app delegate
self.firstAppViewController = [[FirstAppViewController alloc]initWithNibName:@"FirstAppViewController" bundle:nil];
[self.window.contentView addSubview:self.firstAppViewController.view];
self.firstAppViewController.view.frame = ((NSView*)self.window.contentView).bounds;
After this the application shown the window like below !!
References:
No comments:
Post a Comment