【发布时间】:2017-03-12 12:09:55
【问题描述】:
我正在尝试以编程方式将 nib 加载到集合视图单元格中,但出现 NSException 错误。不知道为什么。
if let nib = Bundle.main.loadNibNamed("CardCellBottom", owner: self, options: nil)?.first as? CardCellNib {
nib.translatesAutoresizingMaskIntoConstraints = false
nib.frame = bounds
bottomView.addSubview(nib)
}
如果我从视图中删除此代码,一切正常。所以问题就在这里。 “CardCellBottom”被正确命名,并且 CardCellNib 继承自 UIView。
谢谢
【问题讨论】:
标签: ios swift uicollectionview nib