ios - synthesizing properties with trailing underscore -


i'm following along lynda.com ocunit testing tutorial uses xcode 4. in 1 of demos, synthesizes properties in location.m file this

#import "location.h"  @implementation location  @synthesize locationmanager=locationmanager_; @synthesize speed=speed_; 

the properties have trailing underscore. in other tutorials i've followed (such stanford ios class), synthesized properties prefixed underscore instance variables.

when properties created in .h file, there no underscores.

@property (nonatomic, strong) cllocationmanager *locationmanager; @property float speed; 

why trailing underscore in synthesize statement?

by writing

@synthesize locationmanager=locationmanager_; 

you defining ivar locationmanager_which backs property.

so, property still refer using

self.locationmanager 

however, ivar, "behind" property called: locationmanager_


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -