美文网首页
IOS view的圆角和阴影并存

IOS view的圆角和阴影并存

作者: 小刘_假装是个程序员 | 来源:发表于2018-03-06 18:16 被阅读0次

转载: http://blog.csdn.net/iitvip/article/details/8518260

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];

效果如下

image

/* When true an implicit mask matching the layer bounds is applied to

  • the layer (including the effects of the `cornerRadius' property). If
  • both mask' andmasksToBounds' are non-nil the two masks are
  • multiplied to get the actual mask values. Defaults to NO.
  • Animatable. */

相关文章

网友评论

      本文标题:IOS view的圆角和阴影并存

      本文链接:https://www.haomeiwen.com/subject/ekurfftx.html