私はカスタムUICollectionViewである単純なココアポッドをやっています。しかし、私はUICollectionViewCellのxibファイルを使用することができません。私はエラーを取得しています:未知の例外 'NSInternalInconsistencyException'の理由でアプリケーションを終了しています:理由: 'バンドルでNIBをロードできませんでした:' NSBundle(ロード) '名前' CWNumberedCollectionViewCell '。NIBをバンドルにロードできませんでした。 Cocoa Podプロジェクト
import UIKit
class CWNumberedCollectionViewCell: UICollectionViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
import Foundation
import UIKit
public class CWCollectionViewNumbered: UICollectionView{
let cellIdentifier = "CWCell"
public init(frame: CGRect, layout: UICollectionViewFlowLayout, parent: UIView) {
super.init(frame: frame, collectionViewLayout: layout)
self.allowsMultipleSelection = true
self.delegate = self
self.dataSource = self
self.register(UINib.init(nibName:"CWNumberedCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: cellIdentifier)
self.backgroundColor = UIColor.blue
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override public func selectItem(at indexPath: IndexPath?, animated: Bool, scrollPosition: UICollectionViewScrollPosition) {
print("tapped")
}
}
I have added the xib file to copy bundle resource.