Why Is Uicollectionviewcell's Outlet Nil

Why is UICollectionViewCell's outlet nil?

I am calling self.collectionView.registerClass(LeftMenuCollectionViewCell.self, forCellWithReuseIdentifier: "ls") again. If you are using a storyboard you don't want to call this. It will overwrite what you have in your storyboard.

If you still have the problem check wether reuseIdentifier is same in dequeueReusableCellWithReuseIdentifier and in storyboard.

IBOutlets in UICollectionView are nil - Swift

Instead of:

self.seriesCollectionView.register(MyCell.self, forCellWithReuseIdentifier: "MyCell")

use:

self.seriesCollectionView.register(UINib(nibName: "MyCellXibName", bundle: nil), forCellWithReuseIdentifier: "MyCell")

IBOutelt found nil when UICollectionViewCell is load

That's because you have to register cell's nib not just class:

collectionView.register(UINib(nibName: "HomeCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell")

Why is UICollectionViewCell's outlet nil in Interface Builder Xcode7.1 OS X Yosemite?

If you are using a nib file then you need to register nib file. check the below code

Change your code for registerClass to registerNib

 self.collectionView?.registerNib(UINib(nibName: "yourcellclass", bundle: nil), forCellWithReuseIdentifier: "identifier")

IBOutlet: Unexpectedly found nil while implicitly unwrapping an Optional value

Remove this line from your viewDidLoad method.

collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")

It is used to register a programmatically created collection view cell in the collection view.
If you use this method when you have everything in storyboard, it will create a cell where its IBOutlets are nil.



Related Topics



Leave a reply



Submit