Reputation: 35112
There is no error log just this what I see.
I have a dynamic prototype UICollectionViewCell, and loading in here:
override func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) -> UICollectionViewCell! {
var cell: LeftMenuCollectionViewCell
cell = collectionView.dequeueReusableCellWithReuseIdentifier("xxx", forIndexPath: indexPath) as LeftMenuCollectionViewCell // <- at this line something goes wrong
return cell
}
I am registering class before:
self.collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "xxx")
Using iOS 8 beta 5 now
Upvotes: 0
Views: 1924
Reputation: 35112
Agree with the two solution below, I registered cell incorrectly, but afterward I found an other issue, cell's outlets become nil. And the solution for that was to remove whole registration, if UICollectionViewController was created via Interface Builder.
Upvotes: 2
Reputation: 42977
You have registered UICollectionViewCell
instead of your own cell class LeftMenuCollectionViewCell
. So that the casting of
UICollectionviewCell as LeftMenuCollectionViewCell
is breaking and causing the crash. To fix this register the proper class
self.collectionView.registerClass(LeftMenuCollectionViewCell.self, forCellWithReuseIdentifier: "xxx")
Upvotes: 2
Reputation: 13630
You have registered the cell incorrectly. Try this:
self.collectionView.registerClass(LeftMenuCollectionViewCell.self, forCellWithReuseIdentifier: "xxx")
Upvotes: 1