IOS view的圆角和阴影并存

 UIView *v=[[UIView alloc]initWithFrame:CGRectMake(10, 10, 100, 100)];
    v.backgroundColor=[UIColor yellowColor];
    //v.layer.masksToBounds=YES;这行去掉
    v.layer.cornerRadius=10;
    v.layer.shadowColor=[UIColor redColor].CGColor;
    v.layer.shadowOffset=CGSizeMake(10, 10);
    v.layer.shadowOpacity=0.5;
    v.layer.shadowRadius=5;

    [self.view addSubview:v];

 

效果如下

 

 

/* When true an implicit mask matching the layer bounds is applied to
 * the layer (including the effects of the `cornerRadius‘ property). If
 * both `mask‘ and `masksToBounds‘ are non-nil the two masks are
 * multiplied to get the actual mask values. Defaults to NO.
 * Animatable. */

IOS view的圆角和阴影并存,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。