IOS view的圆角和阴影并存

转载: 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. */
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 参考(cocoachina):iOS-Core-Animation-Advanced-Techniques 简述 ...
    geekMole阅读 5,054评论 0 1
  • 转载:http://www.jianshu.com/p/32fcadd12108 每个UIView有一个伙伴称为l...
    F麦子阅读 11,508评论 0 13
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,178评论 0 10
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 10,542评论 5 13
  • 俗话说,养肝肾就是养命,肝肾不好,未老先倒!肝肾作为我们人体重要的、也是身体里最强大、功能最多的器官。肝肾养好了,...
    lilitaisi阅读 4,383评论 0 2

友情链接更多精彩内容