【问题标题】:Load a nib into a collectionView cell using Swift 3使用 Swift 3 将 nib 加载到 collectionView 单元格中
【发布时间】: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


    【解决方案1】:

    我设法解决了这个问题。原来文件名不正确。希望这可以帮助任何人:)

    【讨论】:

      猜你喜欢
      • 2022-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      • 2018-07-08
      • 1970-01-01
      相关资源
      最近更新 更多