Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 05-06-2009, 07: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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,156
Threads: 38,931
Posts: 170,811
Top Poster: smasher (2,565)
Welcome to our newest member, hoshimori
Powered by vBadvanced CMPS v3.1.0

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