繁体   English   中英

iOS9中的[_UIFlowLayoutSection updateEstimatedSizeForSection]中的UICollectionView崩溃 - Xcode7

[英]UICollectionView crash in [_UIFlowLayoutSection updateEstimatedSizeForSection] in iOS9 - Xcode7

我尝试使用UICollectionViewCell自动布局。 演示项目在iOS8上运行良好但在iOS9上崩溃。 我尝试深入调试,但找不到任何理由。 Xcode停在[_UIFlowLayoutSection updateEstimatedSizeForSection]

任何的想法?

我刚下载了你的项目。 首先转到您的故事板并单击您的标签,在标识符窗格中将标记值更改为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

最后在视图控制器类中注释掉第33行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM