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
Using JSONencoder to Encode a Variable with Codable as Type
Detect iOS Application About to Delete
Cannot Use Instance Member Within Property Initializer
Nsdata Won't Accept Valid Base64 Encoded String
How to Show Alertview with Activity Indicator
How to Show a Collectionview Like Facebook Upload Image Using Swift 4
Cannot Subscript a Value of Type '[Nsobject:Anyobject]' with an Index of Type 'String'
Swiftui - iOS 13 Uiviewrepresentable of Wkwebview Gets Thread 1: Exc_Breakpoint Crash
In Swift, How to Let Other Apps Continue to Play Audio When My App Is Open
More Efficient Way to Retrieve Firebase Data
iOS 13.1 Crash in Avaudio Player
What Is Sandbox in iOS? How to Transfer Data Between One App to Another App
Resize Textfield Based on Content
Nsdateformatter Milliseconds Bug
How to Force a Hkquery to Load the Most Recent Steps Counts
Screenshot Showing Up Blank - Swift