相关疑难解决方法(0)

无法使类型的视图出列:带标识符的UICollectionElementKindCell

我有UICollectionView,但似乎我设置了一切正确.但我得到错误:

'could not dequeue a view of kind: UICollectionElementKindCell with identifier PeopleCellForList  - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
Run Code Online (Sandbox Code Playgroud)

我的故事:

在此输入图像描述

在此输入图像描述

在此输入图像描述

我的代码是:

@interface PeopleCellForList : UICollectionViewCell

@end

@implementation PeopleCellForList

@end


#pragma mark - UICollectionView Datasource

- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section {
    return self.arrayPeople.count;
}

- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView {
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"PeopleCellForList " forIndexPath:indexPath];
    return cell;
}

#pragma …
Run Code Online (Sandbox Code Playgroud)

ios uicollectionview uicollectionviewcell uicollectionviewlayout

4
推荐指数
1
解决办法
2万
查看次数