UIView,UIImageView支持顶端圆角的方式
2012-12-10 14:47
537 查看
最近在项目中需要只有顶端两个为圆角,其他的地方不改变,在网上看了很多地方,拿来的代码都不能直接使用。
所以决定自己研究一下,主要参考了
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIBezierPath_class/Reference/Reference.html#//apple_ref/occ/clm/UIBezierPath/bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:
这个方法,以及CAShapeLayer这个方法
顶端圆角的设置,可以直接使用。后面会把画图相关的操作继续研究,发出来共享。
CAShapeLayer *styleLayer = [CAShapeLayerlayer];
UIBezierPath *shadowPath = [UIBezierPathbezierPathWithRoundedRect:cardStyleView.boundsbyRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(8.0, 8.0)];
styleLayer.path = shadowPath.CGPath;
cardStyleView.layer.mask = styleLayer;
所以决定自己研究一下,主要参考了
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIBezierPath_class/Reference/Reference.html#//apple_ref/occ/clm/UIBezierPath/bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:
这个方法,以及CAShapeLayer这个方法
顶端圆角的设置,可以直接使用。后面会把画图相关的操作继续研究,发出来共享。
CAShapeLayer *styleLayer = [CAShapeLayerlayer];
UIBezierPath *shadowPath = [UIBezierPathbezierPathWithRoundedRect:cardStyleView.boundsbyRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight) cornerRadii:CGSizeMake(8.0, 8.0)];
styleLayer.path = shadowPath.CGPath;
cardStyleView.layer.mask = styleLayer;
相关文章推荐
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- UIView,UIButton,UIImageView等视图设置圆角,设置阴影,设置边框的方法
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- UIView或者UIImageView的圆角处理
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- iOS uiimage和其它view 设置圆角的方式
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
- UIButton UIImageVIew UIView UILabel 等控件设置一个圆角
- IOS第12天(1,UIViewController控制器的创建的 三种方式,和第一个view创建)
- UIView/UIImageView/UIButton... 调用setCornerRadius无效问题
- UIImageView加载图片的两种方式
- 容易使用的支持缩放的UIImageView
- IOS如何给VIEW设置2个圆角?set cornerRadius for only top-left and top-right corner of a UIVIEW
- OC-UIImage动画&UIImageView动画&UIView动画NSTimer动画
- UIImageView圆角,自适应图片宽高比例,图片拉伸,缩放比例和图片缩微图
- iOS个人整理06-第一周小结,常用控件UIView,UILabel,UIImageView,UIButton,UITextField
- UIImageView 设置 圆角