功能:让编译好器自动编写一个与数据成员同名的方法声明来省去读写方法的声明。
如:
1、在头文件中:
- @property int count;
等效于在头文件中声明2个方法:
- - (int)count;
- -(void)setCount:(int)newCount;
2、实现文件(.m)中
- @synthesize count;
等效于在实现文件(.m)中实现2个方法。
- - (int)count
- {
- return count;
- }
- -(void)setCount:(int)newCount
- {
- count = newCount;
- }
647



被折叠的 条评论
为什么被折叠?



