标签云

微信群

扫码加入我们

WeChat QR Code

I'm new to Obj-C, so my first question is:What are the differences between strong and weak in @property declarations of pointers to objects?Also, what does nonatomic mean?


actually this is a good questions, sometimes, we forgot how the basic concept of strong/weak and atomic/nonatomic preferences.... :)Thank you for reminding us about it...

2019年05月24日56分07秒

JackyBoy Whats funny is that the proposed simple search on google lead me here lol. #circularreference

2019年05月23日56分07秒

I tend not to trust many of the answers on google but always refer to S.O for intelligent answers

2019年05月24日56分07秒

Does atomic really guarantee thread safety? I think not.

2019年05月24日56分07秒

Bourne: That depends on what you mean by thread safety. atomic guarantees that the property can be safely read and written from several threads at the same time. That does not mean an object whose properties are all atomic is automatically thread-safe.

2019年05月24日56分07秒

Great details. I think I didn't really get it until now. Thank you.

2019年05月24日56分07秒

As per apple documentation, atomic and nonatomic should be synonymous with thread safety. developer.apple.com/library/ios/documentation/cocoa/conceptual/…

2019年05月24日56分07秒

"Note: Property atomicity is not synonymous with an object’s thread safety." developer.apple.com/library/ios/documentation/cocoa/conceptual/…

2019年05月24日56分07秒

Hey nice explanation !!! Thanks :) +1

2019年05月23日56分07秒

+2 (if only I could). Seriously, really creative explanation!

2019年05月23日56分07秒

After 1 and a half years of iOS developing, I think just now I clearly understood what strong and weak actually mean.

2019年05月24日56分07秒

X.Li Retain cycle is like you have 2 strings to the ballon, one of them is owned by you (so you own this ballon), the other is owned by the ballon (so this ballon owns you). Since you only have access to your string, how do you let the ballon go if the ballon doesn't wanna go? So it's better you own the ballon (strong) while the ballon doesn't own you (weak). When you want to let it go, just cut the string :)

2019年05月23日56分07秒

Read his profile, he's an iOS instructor. Very creative explanation !! Hats Off :)

2019年05月24日56分07秒

And what does etc contain :P

2019年05月23日56分07秒

webView, mapView,etc

2019年05月24日56分07秒

actually most of the subview that we drag and drop on storyboard

2019年05月24日56分07秒