iOS10中CollectionView滑動崩潰

2016-10-09 16:00:31.243 daodaokefu[18373:956971] *** Assertion failure in -[UICollectionViewData layoutAttributesForItemAtIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3599.6/UICollectionViewData.m:709app

2016-10-09 16:00:31.253 daodaokefu[18373:956971] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForItemAtIndexPath: <NSIndexPath: 0xc000000000c00116> {length = 2, path = 1 - 6}'ide

解決:ui

在layout中添加方法it

    override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {io

        return attributes[indexPath.row]exception

    }方法

具體緣由爲何這麼作尚未搞清楚,不過崩潰問題解決。im

相關文章
相關標籤/搜索