4

I try to using auto-layout with UICollectionViewCell. Demo project runs fine on iOS8 but crash on iOS9. I try debug deeper but cannot find any reason. Xcode stop at [_UIFlowLayoutSection updateEstimatedSizeForSection]

Any idea?

zendobk
  • 548
  • 1
  • 5
  • 17

1 Answers1

0

I just downloaded your project. First of all goto your storyboard and click on your label, in identifier pane change the tag value to something like 100.

In your cellForItemAtIndexPath Function replace present implementation with

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

Finally comment out line number 33 in your view controller class

harsha yarabarla
  • 506
  • 4
  • 11