UICollectionViewCell 设置圆角阴影

注意:

  1. 必需设置背景色
  2. self.layer.masksToBounds 必需为NO
self.backgroundColor = UIColor.whiteColor;
self.layer.masksToBounds = NO;
self.layer.cornerRadius = 8;

self.layer.shadowOpacity = 0.16;   //阴影透明度
self.layer.shadowColor = [UIColor blackColor].CGColor;   //阴影颜色
self.layer.shadowRadius = 4;  //模糊计算的半径
self.layer.shadowOffset = CGSizeMake(0, 0);   //阴影偏移量

你可能感兴趣的:(UICollectionViewCell 设置圆角阴影)