• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: noob: Question about senders and views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: noob: Question about senders and views
      • From: "Eric E. Dolecki" <email@hidden>
References: 
 >noob: Question about senders and views (From: "Eric E. Dolecki" <email@hidden>)
 >Re: noob: Question about senders and views (From: Craig Williams <email@hidden>)
 >Re: noob: Question about senders and views (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: noob: Question about senders and views
  • Next by Date: Re: Programatically creating NSMenu?
  • Previous by thread: Re: noob: Question about senders and views
  • Next by thread: Re: noob: Question about senders and views
  • Index(es):
    • Date
    • Thread