Cas*_*ash 6 objective-c iboutlet
代码生成器Accessorizer有一个选项来分配IBOutlets而不是保留它们.例如,比较这两个生成的行:
@property(nonatomic,retain)IBOutlet UIImageView *backgroundView;
@property(nonatomic,assign)IBOutlet UIImageView *backgroundView;
Run Code Online (Sandbox Code Playgroud)
为什么我要分配IBOutlets,同时保留所有其他属性?
小智 15
用法取决于内存管理指南中指定的平台:
"网点的行为取决于平台(参见"Mac OS X桌面"和"iPhone"),因此实际声明有所不同:
Run Code Online (Sandbox Code Playgroud)For Mac OS X, you should use: @property (assign) IBOutlet UserInterfaceElementClass *anOutlet; For iPhone OS, you should use: @property (nonatomic, retain) IBOutlet UIUserInterfaceElementClass *anOutlet;"