英寸。 12在“抛光它上面”部分中,它可以添加新的iboutlet dodbarbutton为:
@iboutlet. VAR DOYBARBUTTON:UIBARBUTTONITEM!
这样做可能会导致强大的参考周期,我相信如果没有正确处理,这可能会对其他读者崩溃。

它应该是一种薄弱的关系:
@iboutlet. 弱val denbarbutton:uibarbuttonitem!

感谢您的反馈意见 :least_smile:

While conventional wisdom states that you should have outlets be weak, not having the outlets as weak does not necessarily pose a problem. In fact, Apple has flip flopped between having outlets as week or as strong at different times.

In fact, some versions of Xcode, if I recall correctly, generated code that had the outlet be strong. So, while I agree that having outlets be weak is what most people seem to go with, it doesn’t mean that you’ll have crashes just because you defined an outlet as strong (or not weak).

有关更多信息,请参阅以下讨论: