collectionview设置圆角和阴影

self.contentView.layer.masksToBounds = YES;

self.contentView.layer.cornerRadius = 3;

self.contentView.layer.borderWidth = 1;

self.contentView.layer.borderColor = FXRGBA(0, 0, 0, 0.08).CGColor;

self.layer.shadowOffset = CGSizeMake(0, 2);

self.layer.shadowColor = FXRGBColor(0, 0, 0).CGColor;

self.layer.shadowOpacity = 0.1;

self.layer.shadowRadius = 4;

self.layer.masksToBounds = NO;

不知道为什么cell设置阴影必须把masks设置为NO不然无效,但这是就不能设置阴影了,所以在contentView和cell上分别设置

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