fundamental question: how do I call controller methods from other classes?
fundamental question: how do I call controller methods from other classes?
- Subject: fundamental question: how do I call controller methods from other classes?
- From: "Matthew Youney" <email@hidden>
- Date: Wed, 21 May 2008 20:07:05 -0400
This is a very basic question:
How do I call controller methods from other classes?
Or even a more basic question:
What is the instance name of the controller object instantiated by Interface
Builder?
I am am new to Cocoa, however a career programmer, and I am feeling quite
dumn here. I am obviously missing some rudimentary concept of the Interface
Builder/MVC/cocoa architecture, and would greatly appreciate any guidance
about how all of this works. I have been through the apple tutorials (quite
simple), documentation, Book:"Learning Cocoa with Objective C" etc, and feel
I just need a bit of a nudge to get going here.
What I need to do is quite simple. I have a controller class named
POSsocketController that is controlling my view created in interface
builder. I have a method defined in this class:
- (void) showStatus: (NSString*) statusString
{
[statusField setStringValue:statusString];
[statusField display];
}
I have a model class POSsocket. At various points, I need to update the
view.
The name of the controller object in interface builder is
myPOSsocketController, and the following gives the compiler error
"myPOSsocketController undeclared or first use in function"
NSString *strStatus = @"Waiting for connections...";
[POSsocketController showStatus: strStatus];
If I create a new instance of POSsocketController, I can compile and run,
the function showStatus is entered, however the screen is not updated. For
example:
POSsocketController * myPOSsocketController = [[POSsocketController
alloc]init];
NSString *strStatus = @"Waiting for connections...";
[myPOSsocketController showStatus: strStatus];
I would expect the above behavior because 1, I am not calling a class
method, and 2, This is not the correct instance of my controller class.
What am I missing?
________________________________________________________________
Sent via the WebMail system at youney.com
_______________________________________________
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