设置UIView圆角的拓展
来源:互联网 发布:python pip yum源 编辑:程序博客网 时间:2024/06/10 09:06
@interface UIView (RectCorner)
@end
@implementation UIView (RectCorner)
//对于左右上角的圆角修饰
- (void)setCornerOnTop
{
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(10.0f, 10.0f)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
[maskLayer release];
}
//对于左右下角的圆角的修饰
- (void)setCornerOnBottom
{
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:(UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0f, 10.0f)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
[maskLayer release];
}
//对于所有的圆角进行修饰
- (void)setAllCorner
{
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10.0];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
[maskLayer release];
}
//不修饰
- (void)setNoneCorner
{
self.layer.mask = nil;
}
@end
//重写view的类目
#import "UIView+Corner.h"
@implementation UIView (Corner)
-(void)addCornerType:(UIRectCorner)corners AndCornerSize:(CGSize)size
{
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:size];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc]init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
}
@end
0 0
- 设置UIView圆角的拓展
- 设置UIView圆角的拓展
- 设置UIView圆角的拓展
- 设置UIView圆角的拓展
- IOS UIView--动画、圆角的拓展
- UIView的圆角设置
- UIView设置圆角
- UIView 设置圆角
- UIView 设置圆角
- UIVIEW圆角设置
- UIView 设置圆角
- UIView 设置圆角
- uiView 设置圆角
- UIView设置圆角
- UIVIew设置圆角
- 设置UIview的圆角效果
- UIView部分圆角设置
- UIVIEW如何设置圆角
- 网站吞吐量的含义
- 序列化和反序列化
- Java变量初始化顺序
- PyQt汇率兑换工具实现的代码,需要引用上一节写的DataMake类
- jquery dataTable 导入js后 页面报length of undefined
- 设置UIView圆角的拓展
- CXF和Axis2
- session基础
- 将智能机器人的“大脑”放在云端网络上,他们如何用区块链技术解决信息安全问题?
- RESTful
- sbt安装及测试
- SpringMvc入门
- 我为什么不继续做java,用4个月转做了Hadoop开发?
- 大牛谈看文献的方法,共勉之