Re: noob: Question about senders and views
Re: noob: Question about senders and views
- Subject: Re: noob: Question about senders and views
- From: "I. Savant" <email@hidden>
- Date: Wed, 8 Apr 2009 14:12:10 -0400
On Wed, Apr 8, 2009 at 1:58 PM, Eric E. Dolecki <email@hidden> wrote:
> How can I make FirstViewController aware of the method in the second class?
> I tried import and still got a warning.
...
> [SecondViewController populateTextFieldWithString:@"hey there"];
...
> As soon as I call that method the app bombs... it has no idea what that
> method in the SecondViewController is...
You're missing some very basic Objective-C concepts. Give this
entire document a *thorough* read:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
Essentially, you're sending an "instance method" message to a class.
You need to understand the difference between a class and an instance
of a class. With that understanding, you need to read about the MVC
design pattern:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6-SW1
... then consider your application's architecture. This is how you
decide where the best place is (some main controller in your case) to
hold the reference (or outlet) to an instance of your
SecondViewController.
--
I.S.
_______________________________________________
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