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

标签 ios autolayout uicollectionview ios9 uicollectionviewcell

我尝试通过 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/

相关文章:

ios - Xcode 6 自动布局按钮相互重叠

ios - UICollectionView 滑动

ios - 当 View 当前不可见时更改 Collection View 的滚动位置

ios - 无法调用非功能类型double的值

ios - UISlider 详细信息 iOS 5.1 中的 Splitviewcontroller View 损坏

ios - Swift 中具有动态高度的 UITableView

ios - 以编程方式选择尚未加载的 UICollectionView 单元格

ios - 如何为自定义 UITableView 标题部分 Nib 添加分隔线?

ios - Apple 应用商店指南 - 加载进度

ios - tableViewCell 内的 UIlabel 对齐方式取决于尺寸类别