Re: Building an MVC based App for Mac OS X - NOT for iOS
Re: Building an MVC based App for Mac OS X - NOT for iOS
- Subject: Re: Building an MVC based App for Mac OS X - NOT for iOS
- From: YT <email@hidden>
- Date: Mon, 27 May 2013 20:34:26 -0700
On May 27, 2013, at 7:56 PM, Jens Alfke <email@hidden> wrote:
>
> On May 27, 2013, at 6:46 PM, Keary Suska <email@hidden> wrote:
>
>> Mac OS X development os much more complicated than iOS development. It is not likely somehting you can just dive into without a learning curve.
>
> Well, it’s different. Coming from OS X, I’ve found iOS UI development the more difficult of the two, because the UI is so much more limited, there is no document model or user-accessible filesystem, there’s very little you can do when in the background, etc.
>
> I don’t think either is diveable-into, even if you’re comfortable with the other.
>
> Anyway, to answer YT’s original question: To create new controllers you can use the New File… command and create a new OS X NSWindowController or NSViewController subclass. Xcode will put boilerplate code in the new files and even create .xibs. If you’re creating a document-based app you may want to create an NSDocument subclass, which is higher-level and abstracts the file I/O for you.
>
> —Jens
SO... I'm not sure if I did this correctly BUT... I may have found a miss type in the Apple Guide: Edit User Interfaces
Here is an extracted section
Doc extract------------------------------
Add a New Controller
Every nib file is created with a File’s Owner object, which you link to the controller for the file. In the rare event that you need to add another controller to a nib file (to control a subview, for example), you need to create source files for the controller and add a controller object to the nib file so that you can make connections to the controller.
To add a controller to a user interface file:
Add the header and implementation files to your project.
Select the Objective-C Class template, enter your custom controller class’s name, and specifyNSController as its superclass.
From the Object library, drag an Object object to the Interface Builder dock.
Select the custom view and specify its class as the class you added in step 1 by identifying it in the Identity inspector.
To see the outlets and actions provided by the controller, select the controller object in the dock and open the Connections inspector. To add new actions or outlets to the controller, see “Make Connections Directly Between User Interface Objects and Your Source Files.
DONE ----------------
I followed the above selecting the custom view and it didn't work.
I THINK in Step 3 "Select the custom view" should read "Select the Object object".
SO what I am after is a ViewController. I have a View placed in a Window where I use Quartz 2D to draw graphics into and need a Controller. The Interface Builder was trying to force me to place ACTIONS AND OUTLETS in the Delegate files.
I found that (as a nubee) very disconcerting and confidence shaking with regard to my experience with using an MVC.
So in Step 1 above I created MyViewController files SuperClass NSView.
In Step 2 & 3 I dragged a Object object into the Builder Doc and in the inspector classed it as MyViewController.
THEN (perhaps an important tip) I went to the File's Owner in the Builder Doc, open the connection list and disconnected the auto generated Delegate connection from the File's Owner Outlets.
THEN I opened the Helper Editor and it automatically brought up the Delegate.h
THEN I manually switched the Helper file to MyController.h
AND the BUILDER allowed me to set the ACTION and OUTLETs in the MyController file.
Well my tests have worked so far SOoooo now I will give it go on placing graphics data into a model.
AND the interactive element ACTIONS AND OUTLETS into the Controller.
YT
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden