IBOutletCollection没有与Storyboard中的uilabel连接



我有一个IBoutletCollection属性连接到Storyboard中的几个UILabels:

@property (weak, nonatomic) IBOutletCollection(UILabel) NSArray *labels;

叫做

viewDidLoadNSLog(@"%ld",(long)self.labels.count)

得到0作为结果

这是什么问题,我这里有空的ivar ?

Autolayout有什么问题吗?(是的,我在Storyboard中使用它)

谢谢你的建议!

weak更改为strong

@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labels;

最新更新