small medium large xlarge

Generic-user-small
21 May 2011, 15:58
Sal Tuccitto (2 posts)

Hi,

Using Xcode 4, is it still possible to create a controller class that is derived from NSObject as described in chapter 8? I cant seem to make it go and according to this link, http://developer.apple.com/library/ios/#documentation/IDEs/Conceptual/Xcode4TransitionGuide/InterfaceBuilder/InterfaceBuilder.html one has to derive the controller from NSWindowController to let the interface builder magic happen. Is this correct or can controllers still be derived from NSObject as described in chapter 8?

Thanks for the clarification, Sal

p.s. great book, will there be a version specific to xcode 4?

Generic-user-small
22 May 2011, 13:00
Sal Tuccitto (2 posts)

I should have looked through the link I provided above a little closer.

From the above link, here’s what needs to be done to make a controller based on NSObject to Interface Builder (this has changed from xcode3 to xcode4 and impacts chapter 8 section 3):

Create Your Interface Controller in Xcode, Then Add a Controller Object to the Nib File

“To create a new controller for a nib file, first use the New File dialog to create interface and implementation files for the new class. Use the Objective-C class template and make the templates a subclass of NSObject. If you want to make connections in Interface Builder to the outlets and actions of the controller, drag the Object object from the Object library in the Utilities pane into the dock of your Interface Builder nib file (Figure 4-7). (Tip: Type nsobject into the search field to find the object quickly.) Select the new object in the dock and use the class field under Custom Class in the Identity inspector (Figure 4-5) to assign the class of your controller to the object. Then use the Label field in that same inspector to change its display name.”

You must be logged in to comment