1.程序奔溃并且报错 reason: 'could not dequeue a view of kind: UICollectionElementKindSectionHeader with identifier GTNotificationReusableView - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' 时,应该查看是否已经注册以及注册方法有没有出错,collectionView.register(UINib(nibName:headerlName, bundle:nil), forSupplementaryViewOfKind:UICollectionElementKindSectionHeader, withReuseIdentifier:headerlName)
2.程序奔溃并且报错 Could not cast value of type 'UICollectionReusableView' (0x1137cafe0) to xxx
这个是因为类型不同强转导致的,这种情况修改的方法是将CollectionReusableView的类型改成我们自定义的类名。


网友评论