I am new to iOS programming.I have created a customcell class and awakefromnib method is not getting called because of this the IBOutlets are comings as nil! It is driving me crazy! Please help! I am using storyboards not xibs.
I also ran into this issue and the problem was I was calling:
self.collectionView.register(CollectionCell.self, forCellWithReuseIdentifier: "CollectionCell")
even though I had actually added the collection view cell in the storyboard. If that's the case then registering the class is unnecessary and causes all your IBOutlets to be nil when the cell is dequeued
I recently ran into this issue and it was due to incorrectly registering the cell. To have the UITableViewCell
loaded from a nib you need to register like this:
override func viewDidLoad() {
super.viewDidLoad()
// .....
let cellNib = UINib(nibName: "YourCellNibName", bundle: nil)
tableView.register(cellNib, forCellReuseIdentifier: "YourCellIdentifier")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With