Definitions 1
X.h
@ Interface XXX
@ Property (strong, nonatomic) objectType object;
@ End
X.m
@ Synthesize object;
Define 2
X.h
@ Interface XXX
@ Property (strong, nonatomic) objectType object;
@ End
X.m
@ Synthesize object = _object;
Define 3
X.h
@ Interface XXX
{ObjectType _object;}
@ Property (strong, nonatomic) objectType object;
@ End
X.m
@ Synthesize object;
Define 4
X.h
@ Interface XXX
{ObjectType object;}
@ Property (strong, nonatomic) objectType object;
@ End
X.m
@ Synthesize object = _object;
Please help adults explain several definitions above, in addition to the standard definition of what?
Reply:
object = _object
In fact, this looks like an address assignment. object's address, and you _object address is the same.
Just like in C + +, we will set its initial value as
@ Synthesize is an instance of your member variables. . . . After the class name can be instantiated. Member variables
Can be a little more convenient.
Reply:
Reply:
To the variable alias, _object used as a kind of internal functions, object setting for external calls, such as the use instanceClass.object
Reply:
Usually this:
X.h
@ Interface XXX {
objectType _object ;/ / declare here can not add, but if not, the subclass of X can not use it, and not without good, because people look at you in this class, I found this object class does not _object But m file was used, not easy to read
}
@ Property (strong, nonatomic) objectType object;
@ End
X.m
@ Synthesize object = _object ;/ / here is to allow district classified internal member variables and added _, c + + in general have this habit, so in Xm _object file you can use to manipulate the object, remember similar self. object is to call the method rather than the direct manipulation of object this object
Free to go look at facebook ios sdk code, written in a very personal feeling that the standard
Reply:
@ Property syntax similar set, get methods. Concrete can see my blog. http://blog.csdn.net/holydancer
Reply:
Apple's latest document is the second official website. lz on this chant.
Reply:
If the latest document is the second official website
No comments:
Post a Comment