生成LayoutAttributes时创建indexPath用indexPathWithIndex,会导致在swift中的collectionView返回组头viewForSupplementaryElementOfKind这个方法取indexPath.section时崩溃。改成 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:i]; 就好了
生成LayoutAttributes时创建indexPath用indexPathWithIndex,会导致在swift中的collectionView返回组头viewForSupplementaryElementOfKind这个方法取indexPath.section时崩溃。改成
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:i];
就好了