Swift 2 :IBOutlet Collection [UIButton]! leaks mem

2019-04-21 03:12发布

Recently in my app I have found out that my UIButton outlet collection is leaking memory.

All I have is

    @IBOutlet var TabBarButtons: [UIButton]!

And from Instrument enter image description here

Can anyone tell me what's gone wrong? As time goes on, the amount of variables in the NSArray keeps growing and all I have is an array with 4 UIButtons from IB.

1条回答
走好不送
2楼-- · 2019-04-21 03:40

This is a bug. Reference rdar://24272775

Workaround for now is to replace [UIButton]! with NSArray! and cast its contents to UIButton later when used.

查看更多
登录 后发表回答