一、关于objective-C的属性,常见的有:strong、weak、copy、assign

  1. 对于基本数据类型,当然使用assigin;
  2. 对于mutable的,一定要使用strong。父控件UI元素也使用strong;
  3. 子控件元素使用weak;
  4. 不可变的类型,使用copy。(NSString,NSArray,NSDictonary这些一定要用copy)对于mutable的对象,如果是mutable的却定义属性为copy,则往里面加值时可能引起程序崩溃。而对于不可变的使用了strong,则可能引起值改变,这就违背了内存管理语义

二、关于getter

if (_messageTipNumber > 0) {
       self.tipCountLable.frame = CGRectMake(150, (self.frame.size.height - 14)/2, 14, 14);
       self.tipCountLable.layer.cornerRadius = _tipCountLable.frame.size.width/2;
       self.tipCountLable.text = [NSString stringWithFormat:@"%d",_messageTipNumber];
       [self.contentView addSubview:_tipCountLable];
}