I have the method being called now in SecondViewController, but suddenly my UILabel there is (null). ??
// Called from the FirstViewController -(void)populateTextFieldWithString:(id)string { [commandText2 setText:string]; NSLog(@"populateTextFieldWithString: %@, %@", string, commandText2 ); // string is okay but the UILabel is (null) } A scope issue? On Wed, Apr 8, 2009 at 2:12 PM, I. Savant <idiotsavant2...@gmail.com> wrote: > On Wed, Apr 8, 2009 at 1:58 PM, Eric E. Dolecki <edole...@gmail.com> > 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. > -- http://ericd.net Interactive design and development _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com