解决
reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cellIdentifier - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
代码如下:
NSString *identifier =@"cellIdentifier";
static BOOL nibri =NO;
if(!nibri)
{
NSLog(@"321");
UINib *nib = [UINibnibWithNibName:@"CollectionViewCell"bundle:nil];
[self.collectionViewregisterNib:nib forCellWithReuseIdentifier:identifier];
nibri =YES;
}
CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
NSDictionary *event=[self.eventsobjectAtIndex:(indexPath.section*2+indexPath.row)];
cell.label.text=[eventobjectForKey:@"name"];
cell.imageView.image=[UIImageimageNamed:[event objectForKey:@"image"]];
nibri=NO;