Re: Beginner Question Re: Memory Management
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