我尝试通过 UICollectionViewCell
使用自动布局。 Demo project在 iOS8 上运行良好,但在 iOS9 上崩溃。我尝试更深入地调试,但找不到任何原因。 Xcode 停在 [_UIFlowLayoutSection updateEstimatedSizeForSection]
有什么想法吗?
最佳答案
我刚刚下载了您的项目。首先转到 Storyboard并单击标签,在标识符 Pane 中将标签值更改为 100 之类的值。
在您的 cellForItemAtIndexPath 函数中,将当前实现替换为
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
最后注释掉 View Controller 类中的第 33 行
关于ios - iOS9 中 [_UIFlowLayoutSection updateEstimatedSizeForSection] 中的 UICollectionView 崩溃 - Xcode7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33626680/