Book Image

Cocoa and Objective-C Cookbook

By : Jeff Hawkins
Book Image

Cocoa and Objective-C Cookbook

By: Jeff Hawkins

Overview of this book

<p>Much of Cocoa is implemented in Objective-C, an object-oriented language that is designed to run at high speed. In order to build powerful Cocoa applications you need more than the basics. This cookbook will provide you with the recipes needed to add Core Animation, gestures, Key Value Coding, and QuickTime to your appilications.<br /><br />The Cocoa and Objective-C Cookbook moves developers beyond the basics of developing with Apple's Cocoa framework. It will help you grasp advanced topics needed to build polished Cocoa applications on Mac OS X.<br /><br />The cookbook provides a comprehensive overview of Cocoa's more popular UI components found in all Mac OS X applications. It has recipes for building custom views, adding support for gestures and working with keyboard and mouse events. There are recipes for using singleton, delegation, and factory design patterns in your own application's architecture. Alongside essential recipes for working with databases and debugging you will also find fun recipes covering animation and multimedia. The Cocoa and Objective-C Cookbook will quickly bring you up to speed with advanced technologies used to build complex applications for Mac OS X.</p>
Table of Contents (18 chapters)
Cocoa and Objective-C Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Using your custom view in Interface Builder


In this recipe, we will be using Interface Builder to define the size and location of our custom view. In the last recipe Drawing in your custom view, we created our view programmatically by specifying the view's frame and then adding the view to the windows content view. Using Interface Builder to define your views makes it simpler to visually lay out your interface and set various properties, such as resizing.

Getting ready

Rather than creating a new Xcode project for this recipe, let's duplicate the project from the last recipe Drawing in your custom view.

How to do it...

  1. 1. Open the file CustomViewAppDelegate.m by double-clicking on it.

  2. 2. Remove or comment out all the code in the applicationDidFinishLaunching: method.

  3. 3. Double-click on the MainMenu.xib file to open it in Interface Builder. In Interface Builder's Library palette, locate the Custom View and drag it onto the applications window.

  4. 4. Select the Size tab from the Inspector pallet...