• 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: Why "self"? (Was: Newbie: Referencing Objects)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why "self"? (Was: Newbie: Referencing Objects)


  • Subject: Re: Why "self"? (Was: Newbie: Referencing Objects)
  • From: "john fogg" <email@hidden>
  • Date: Tue, 28 Oct 2008 03:35:55 +0100

Hi again!

I'm still plucking along and any help is still greatly appreciated!

Here is the deal: I create a subobject called "mySubObject" inside my
main object "myMainObject". Now I want to access "myMainObject" from
within "mySubObject".

I'm still not sure what the ideal way to do this would be but I have
gotten it to work somehow. Inside "myMainObject" I create a property
and point it to "self" so it stores a reference to "myMainObject".
Inside "mySubObject" I cannot access this by writing

    [pointerToMainObject doMethod];

but it works when I write

    [self.pointerToMainObject doMethod];

Why? What difference does "self" make here?

I'm still trying to wrap my head around all this stuff so please bear
with me here. :-)
_______________________________________________

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: Why "self"? (Was: Newbie: Referencing Objects)
      • From: "john fogg" <email@hidden>
    • Re: Why "self"? (Was: Newbie: Referencing Objects)
      • From: Ken Thomases <email@hidden>
    • Re: Why "self"? (Was: Newbie: Referencing Objects)
      • From: John Velman <email@hidden>
    • Re: Why "self"? (Was: Newbie: Referencing Objects)
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Can we ask iPhone questions yet?
  • Next by Date: Re: Why "self"? (Was: Newbie: Referencing Objects)
  • Previous by thread: Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • Next by thread: Re: Why "self"? (Was: Newbie: Referencing Objects)
  • Index(es):
    • Date
    • Thread