Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 05-06-2009, 08:34 AM   #3 (permalink)
exorcyze
Registered Member
 
Join Date: Dec 2008
Posts: 495
Default

Quick addendum: When you define a property the critical places you will want to use self.property ( to my knowledge ) are : IF the property variable is an object pointer ( not a primative like int or BOOL ) and you are setting the value.

Code:
@property (nonatomic, readwrite) int someValue;
@property (nonatomic, retain) UIView *someView;

// these two are equivalent
someValue = 3;
self.someValue = 3;

// these two are NOT 
someView = newView;
self.someView = newView; // use this one

// shouldn't matter when *getting* the value
newView = someView;
newView = self.someView;
If you look into a basic tutorial on writing properties yourself it should become fairly apparent what happens behind the scenes when you use the @property/@synthesize statements, which should make it more obvious which cases you need to use self ( to go through the property accessors ).

=)
__________________
My Apps on AppStore : gScale (guitar scales reference), eMaze, eMaze Lite, eTimesheet
exorcyze is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,668
Threads: 89,155
Posts: 380,379
Top Poster: BrianSlick (7,110)
Welcome to our newest member, dhainiuloxi
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.