我有一个IBoutletCollection
属性连接到Storyboard
中的几个UILabels
:
@property (weak, nonatomic) IBOutletCollection(UILabel) NSArray *labels;
叫做
viewDidLoad
后NSLog(@"%ld",(long)self.labels.count)
得到0
作为结果
这是什么问题,我这里有空的ivar ?
Autolayout
有什么问题吗?(是的,我在Storyboard
中使用它)
谢谢你的建议!
将weak
更改为strong
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labels;