之前一直不理解标题的原理,只是知道strong和weak的区别,现MAC Programming Guard中的一个Tutorial——"Your First Mac App"中的一句话惊醒梦中人啊!
The property specifies the strong
attribute rather than the weak
attribute, indicating that the Track
object is owned by the app delegate. As long as the app delegate references it, the Track
object won’t go away. The outlet property declarations you created earlier use the weak
attribute because the corresponding UI elements are contained in the view hierarchy that is owned by the window, not the app delegate. The window and its view hierarchy can go away independent of the app delegate.
从IB中的UI对象的继承关系在UIView的中,而不是在IBOutlet所在的类中。该UI控件的从创建、使用到消亡,都是UIView的继承关系中保证,而不需要IBOutlet中去管理它的声明周期。所以声明成weak的而不是strong。