Answer the question
In order to leave comments, you need to log in
Why doesn't UICollectionViewCell work?
My ViewController which has a UICollectionView inside. I use it exclusively as a table into which data from JSON is driven. There are 16 cells inside, with identifiers cell1-cell16
class FirstViewController: UICollectionViewController {
@IBOutlet weak var table: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
table.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier:"cell")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath:NSIndexPath)->UICollectionViewCell
{
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell1", forIndexPath: indexPath) as UICollectionViewCell
return cell
}
}
При запуске получаю ошибку
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "9pv-A4-QxB-view-tsR-hK-woN" nib but didn't get a UICollectionView.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question