由于UIView分类中做的处理,同时设置了layer的cornerRadius和masksToBounds属性,影响了圆角和阴影共存,想要共存不能设置masksToBounds为YES。
- (void)setCornerRadius:(CGFloat)cornerRadius
{
self.layer.cornerRadius = cornerRadius;
self.layer.masksToBounds = YES;
}
修改为如下
xxxView.backgroundColor = [UIColor whiteColor];
xxxView.layer.cornerRadius = 3