Re: How do I create a custom view, add it to my XIB file, and then create the subclass?
Re: How do I create a custom view, add it to my XIB file, and then create the subclass?
- Subject: Re: How do I create a custom view, add it to my XIB file, and then create the subclass?
- From: Chris Hanson <email@hidden>
- Date: Sun, 4 May 2008 22:25:50 -0700
On May 4, 2008, at 8:58 PM, Michael A. Crawford wrote:
It has been two years since I did any Cocoa programming and things
have changed. NIBs are now XIBs and the menu item for creating
subclasses in IB is gone. Can someone point me to a current tutorial?
If you update to the latest documentation via the action (gear) menu
in Xcode's documentation window, you should get a revised Cocoa
Application Tutorial that takes Interface Builder 3 into account.
This tutorial is also on the Apple Developer Connection web site: <http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/chapter_1_section_1.html
>.
The primary change in Xcode 3.0 and Interface Builder 3.0 is this:
Create classes in Xcode.
Create instances in Interface Builder.
So you can create your NSView subclass interface & implementation fils
in Xcode, and then just set the custom class of a custom view in
Interface Builder file using the Identity Inspector. (View > Identity
Inspector in Interface Builder's menus.) This is how most developers
have worked with Interface Builder while working on real apps beyond
the tutorials.
You don't need to create a class in Xcode, of course; you can just set
the class of a custom view — or any other object — in Interface
Builder by typing it into the Identity Inspector for that object, and
then generate your custom class using a command in the File menu.
(File > Write Class Files… in Interface Builder's menus.) But the
intended workflow is that Xcode is for creating classes and Interface
Builder is for wiring instances of classes together.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden