Prior to iOS 10, I had a self-sizing table view that solely consisted of a UICollectionView with self-sizing cells using a standard UICollectionViewFlowLayout. The collection v
I got same issue when develop my app on iOS 10 and set UICollectionViewDataSource
to itself on awakeFromNib
,like this:
override func awakeFromNib() {
super.awakeFromNib()
let layout = UICollectionViewFlowLayout()
// set your layout
collectionViewLayout = layout
// set dataSource equal to self in here cause a crash
dataSource = self
}
then I move the UICollectionViewDataSource
setting code to layoutSubviews
,the problem solved,like this:
override func layoutSubviews() {
super.layoutSubviews()
dataSource = self
}
override func awakeFromNib() {
super.awakeFromNib()
let layout = UICollectionViewFlowLayout()
// set your layout
collectionViewLayout = layout
// set dataSource equal to self in here cause a crash
dataSource = self
}
Hope this help!