当cell数量少,可以设置cell的边距,强行将她往左边对齐
- (UIEdgeInsets)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
SourceListModel *model = _dataList[section];
if([model.materialTypeisEqualToString:@"0"]) {
if(model.picList.count>1) {
// 多张素材
returnUIEdgeInsetsMake(0,0,0,0);
}else{
// 单张素材
returnUIEdgeInsetsMake(0,0,0,kScreenWidth-GAP*2- [CYC666getRectFromURL:model.picList.firstObject].size.width);
}
}else{
// 海报
returnUIEdgeInsetsMake(0,0,0,kScreenWidth-GAP*2- [CYC666getRectFromURL:model.poster].size.width);
}
}
网友评论