是什么造成了不同

What made the difference

是什么造成了差异

@property (strong, nonatomic) and @property (nonatomic, strong) 在 ios.

我将像这样定义 iboutlet,例如 uilabel

@property (strong, nonatomic) IBOutlet UILabel *label1;

我在这个网站上看到很多次

@property (nonatomic, strong) NSString* str;

两者有什么区别属性.

逻辑上没有区别。它们代表相同的事物,但顺序不同。

通常在 IBOutlets 中你有 @property (weak, nonatomic) 因为它是当你从界面构建器中按住 ctrl 并拖动时自动生成的。

然而,大多数人更喜欢第二种形式,因为 "nonatomic" 在大多数情况下 在 ios 中使用,因此很容易被忽略。

没有区别。但在苹果示例代码中,我们最常使用:

@property (nonatomic, strong)