iOS view同时加阴影和圆角
2019-06-14 本文已影响0人
麻辣小龙虾的果风
怎么给view加阴影的同时增加圆角:
顺序很重要,先加阴影后加圆角并且不切角;如:
UIView *imgView = [[UIView alloc]init];
imgView.backgroundColor = [UIColor whiteColor];
imgView.layer.shadowColor = [UIColor blackColor].CGColor;
imgView.layer.shadowRadius = 5;
imgView.layer.shadowOffset = CGSizeMake(0, 5);
imgView.layer.shadowOpacity = 0.3;
imgView.layer.cornerRadius = 3;
imgView.clipsToBounds = NO;