• 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: Beginner Question Re: Memory Management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner Question Re: Memory Management


  • Subject: Re: Beginner Question Re: Memory Management
  • From: Peter N Lewis <email@hidden>
  • Date: Wed, 24 Jun 2009 10:18:10 +0800

On 23/06/2009, at 12:31 , WT wrote:
So, after I scratched my head silly for several minutes, it suddenly came to me. If I'm going to use a property, I *must* refer to it as object.property rather than simply as property. In the specific example I had, I should not have replaced all those repeated chunks of code with

textFieldPreviousContent = textField.text;

but with

self.textFieldPreviousContent = textField.text;

This is why I never use the same property name as ivar name.

Many people use the _ prefix for ivars, but whatever prefix or suffix you choose, give the ivar a different name, and then you know when you're accessing the ivar and when you're using the setter/getter.

@synthesize textFieldPreviousContent = _textFieldPreviousContent;

Enjoy,
   Peter.
--
     Clipboard Switching and Macros with Keyboard Maestro

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.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


References: 
 >Beginner Question Re: Memory Management (From: Daniel Torrey <email@hidden>)
 >Re: Beginner Question Re: Memory Management (From: Graham Cox <email@hidden>)
 >Re: Beginner Question Re: Memory Management (From: WT <email@hidden>)

  • Prev by Date: re: Cascade Delete won't delete Department in Apple Sample Code
  • Next by Date: How apply a mask (xxx-xxx-xxxx for phone #) to a text field while inputting?
  • Previous by thread: Re: Beginner Question Re: Memory Management
  • Next by thread: Re: Beginner Question Re: Memory Management
  • Index(es):
    • Date
    • Thread