synthesise 和 property的对应关系。sysnthesise:合成;属性是在 objc中用来标示变量的一个好方法,对应的使用synthesise可以生成相应的setter 和 getter方法。但是也可以不使用·@property来声明变量,可以直接定义变量
@public; @private; @protected,只有变量可以用这个来修饰,默认是protected,对于方法没有这几个修饰符的,方法可以分为对象的方法 就是以 “- (void) dostr()" ,对于类方法可以 “+ (void) dostr()”.
如果想定义方法,可以使用category的方式在类的实现文件中去声明@interface ()。
!!记得synthesise中不会去alloc任何内存的,它只是简单的生成一个getter和setter,如果需要对property申请内存时,一定要重写这个属性的getter方法:
@synthesise property1 = _property1;
如果给一个对象发送消息[object drawRectangel:long andWidth:width],这个object如果是个nil对象怎么办呢? 美关系,这个消息什么也不会做的。