UICollectionView error in [_UIFlowLayoutSection updateEstimatedSizeForSection] in iOS9 - Xcode7

I am trying to use auto-layout with UICollectionViewCell. The demo project works fine on iOS8, but it crashes on iOS9. I try to debug deeper, but I can not find any reason. Xcode stops at[_UIFlowLayoutSection updateEstimatedSizeForSection]

Any idea?

+4
source share
1 answer

I just uploaded your project. First of all, go to your storyboard and click on your shortcut, in the ID panel, change the tag value to 100.

In your cellForItemAtIndexPath function, replace the existing implementation

let cell = collectionView.dequeueReusableCellWithReuseIdentifier(String("LabelCell"), forIndexPath: indexPath)
let str = "dsadasdadaddsfsf"
let len = Int(rand()) % str.characters.count
let label = cell.contentView.viewWithTag(100) as! UILabel;
label.text = str.substringToIndex(str.startIndex.advancedBy(len))
cell.setNeedsLayout()
cell.layoutIfNeeded()
return cell

, 33

0

Source: https://habr.com/ru/post/1615201/


All Articles