Re: "How to create an Objective-C subclass"


Trying to follow instructions in this article to create subclass to use NSReadPixel function.

"Follow these steps to create a new subclass:

  1. In Interface Builder (IB) select the “Classes” tab in your main nib window. Navigate to the class you wish to subclass and select it."

I can’t find these things. Could you go into more detail?

I have a window called “MainMenu.nib” containing icons labeled “File’s Owner”, “First Responder”, “Application”, “WIndow”, and “MainMenu”.

The Inspector window has tabs called “Attributes”, “Effects”, “Size”, “Bindings”, “Connections”, “Identity”, and “AppleScript”.

Also can’t find:

“2) Choose “Classes > Subclass NSSomeClass” from the IB main menu”, “Classes > Create files for NSSomeClass”, nor “In the IB inspector window, go to the “Custom Class” pane.”


It sounds like you’re using the latest version of Interface Builder (version 3, which comes with Leopard)”those instructions are written for earlier versions of IB. To create your own class, I would recommend looking at the “Become an Xcoder” tutorial at CocoaLab, which has been updated to Leopard. They cover creating custom classes in pages 43-45 of the PDF version, which can be downloaded here. If you prefer viewing documents online, then scroll down to “Creating Our Class” in the HTML version here.


Operating System: Mac OS X (10.5)