设置UIView圆角
来源:互联网 发布:传智软件科技有限公司 编辑:程序博客网 时间:2024/05/16 02:46
设置UIView圆角
一个UIView圆角的扩展类
- 设置UIView上半部分圆角
- 设置UIView下半部分圆角
- 设置UIView全圆角
代码
UIView+RectCorner.h@interface UIView (RectCorner)- (void)setCornerOnTopCornerRaii:(CGFloat)cornerRaii;- (void)setCorNerOnBottomCornerRaii:(CGFloat)cornerRaii;- (void)setCornerRadii:(CGFloat)cornerRadii;@end
UIView+RectCorner.m@implementation UIView (RectCorner)- (void)setCornerOnTopCornerRaii:(CGFloat)cornerRaii { UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(cornerRaii, cornerRaii)]; CAShapeLayer *cornerLayer = [[CAShapeLayer alloc] init]; cornerLayer.frame = self.bounds; cornerLayer.path = maskPath.CGPath; self.layer.mask = cornerLayer;}- (void)setCorNerOnBottomCornerRaii:(CGFloat)cornerRaii { UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(cornerRaii, cornerRaii)]; CAShapeLayer *cornerLayer = [CAShapeLayer layer]; cornerLayer.frame = self.bounds; cornerLayer.path = maskPath.CGPath; self.layer.mask = cornerLayer;}- (void)setCornerRadii:(CGFloat)cornerRadii { UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:cornerRadii]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.path = maskPath.CGPath; maskLayer.frame = self.bounds; self.layer.mask = maskLayer;}@end
0 0
- 设置UIView圆角
- 设置UIImage或UIView圆角 、设置UIView边框的代码
- 设置UIImage或UIView圆角 、设置UIView边框的代码
- UIView边框,圆角 透明 设置
- XIB中设置UIView圆角
- CALayer--设置UIView圆角,裁剪子视图,快速圆形UIView
- 设置UIView圆角 部分圆角
- UIView设置圆角
- UIView 设置圆角
- 设置uiView,成圆角矩形
- UIView设置成圆角方法
- UIView 设置圆角
- UIVIEW圆角设置
- UIView 设置圆角
- 设置UIView层次
- 设置UIView背景图片
- UIView设置阴影
- UIView设置成圆角
- HC-05嵌入式蓝牙串口通讯
- swift 字符串的截取 以及 Range 的用法
- python re 替换
- mfc对combox添加item (在UI设计中——)
- LeetCode 318: Maximum Product of Word Lengths
- 设置UIView圆角
- 获取明天的时间
- Android Studio 插件 Statistic
- TCP与UDP的区别
- 1/72th of an inch
- java System.arraycopy
- 子类虚函数表(包括虚函数+函数)
- BeanUtils copyProperties 过滤null记录下
- Lua学习笔记之字符串及模式匹配