最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【整理】Object-C中属性(property)与实例变量(instance variable)之间的区别

Object-C crifan 4138浏览 0评论

 

 

目前得知的结果是:

.h中的interface的大括号{}之间的实例变量,.m中可以直接使用;

.h中的property变量,.m中需要使用self.propertyVariable的方式使用propertyVariable变量

 

 

更多参考,有待后续整理:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocDefiningClasses.html#//apple_ref/doc/uid/TP30001163-CH12-SW1

 

IOS,objective_C中用@interface和 @property 方式声明变量的区别

http://www.cocoachina.com/bbs/read.php?tid=70088&page=1

 

http://stackoverflow.com/questions/3074248/properties-and-instance-variables-in-objective-c-2-0

http://stackoverflow.com/questions/9702258/difference-between-properties-and-variables-in-ios-header-file

 

 

http://www.cocoachina.com/bbs/read.php?tid=95411&keyword=%CA%F4%D0%D4%7C%CA%B5%C0%FD%B1%E4%C1%BF

转载请注明:在路上 » 【整理】Object-C中属性(property)与实例变量(instance variable)之间的区别

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.161 seconds, using 22.06MB memory