Whether I should use @property(nonatomic,copy) or @property(nonatomic,strong) for my (NSString *) attr in An object?

后端 未结 4 570
暗喜
暗喜 2021-02-07 07:10
@interface PaneBean : NSObject

@property(nonatomic,copy) NSString *name;
@property(nonatomic,copy) NSString *type;
@property(nonatomic,assign) NSInteger width;
@end
         


        
4条回答
  •  误落风尘
    2021-02-07 07:53

    Strong indicates composition, while Weak indicates aggregation.

    Copy means that a new object is to be created before the contents of the old object are copied into the new object. The owning object, PaneBean in this case, will be composed of the newly created object.

提交回复
热议问题