摘要: -(id) variable{return (varibale)}-(void)setVariable:(object)newVariable{ [newVariable retain]; [variable release]; variable=newVariable;}-(Trie *) tireAtIndex:(int) index{Tire *tire;tire=[tires objectAtIndex:index];return (tire);}-(void)setTire:(Tire *)tire (int) atIndex{[Tires replaceObjectAt... 阅读全文
posted @ 2012-02-14 14:08 进劲 阅读(268) 评论(0) 推荐(0) 编辑
摘要: self 指的就是类本身,返回的是class 的地址[[self alloc]init]使用[self.]程序会使用对象的内存管理方法,通过内存管理来占用,释放对内存的占用,直接使用variable=a,很容易造成内存的泄漏,所以推荐使用self.varibale=b.当然也有列外,在初始化和释放内存的时候,应当直接使用varibale;比如 variable=[NSArray v];或者[variable release]1,实例方法里面的self,是对象的首地址。2,类方法里面的self,是Class.尽管在同一个类里面的使用self,但是self却有着不同的解读。在类方法里面的self, 阅读全文
posted @ 2012-02-14 14:01 进劲 阅读(330) 评论(0) 推荐(0) 编辑