怎么解决UICollectionViewCell视图重叠
1个回答
展开全部
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
for (UIView *subView in cell.subviews) {
if ([subView isMemberOfClass:[UILabel class]]) { //UILabel 改为自己加的控件
[subView removeFromSuperview];
}
}
...
return cell;
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
for (UIView *subView in cell.subviews) {
if ([subView isMemberOfClass:[UILabel class]]) { //UILabel 改为自己加的控件
[subView removeFromSuperview];
}
}
...
return cell;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询