我有一个 UICollectionView 和一个 customCell,它有一个 UIImageView 我正在添加阴影。但是,在单元格“超出”可见集合视图并返回 (UICollection) 视图之前,不会绘制阴影。
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"genreCell";
GenreViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
cell.genreImageView.layer.shadowRadius = 1.5;
cell.genreImageView.layer.shadowOffset = CGSizeMake(-1, -1);
cell.genreImageView.layer.shadowOpacity = 0.5;
cell.genreImageView.layer.shadowColor = [UIColor blackColor].CGColor;
cell.genreImageView.layer.shadowPath = [UIBezierPath bezierPathWithRect:cell.genreImageView.bounds].CGPath;
return cell;
}