iOS 设置视图的圆角效果
来源:互联网 发布:神创天下骑兵升级数据 编辑:程序博客网 时间:2024/05/16 20:33
- (void)viewDidLoad {
[super viewDidLoad];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(50, 100, 100, 100)];
view.backgroundColor = [UIColor cyanColor];
[self.view addSubview:view];
// (UIRectCorner)corners
// UIRectCornerTopLeft = 1 << 0,
// UIRectCornerTopRight = 1 << 1,
// UIRectCornerBottomLeft = 1 << 2,
// UIRectCornerBottomRight = 1 << 3,
// UIRectCornerAllCorners = ~0UL
// 设置指定角的有圆角效果
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(20, 20)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view.bounds;
// maskLayer.masksToBounds = YES;
maskLayer.borderColor = [UIColor blackColor].CGColor;
maskLayer.path = maskPath.CGPath;
view.layer.mask = maskLayer;
// Do any additional setup after loading the view, typically from a nib.
}
[super viewDidLoad];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(50, 100, 100, 100)];
view.backgroundColor = [UIColor cyanColor];
[self.view addSubview:view];
// (UIRectCorner)corners
// UIRectCornerTopLeft = 1 << 0,
// UIRectCornerTopRight = 1 << 1,
// UIRectCornerBottomLeft = 1 << 2,
// UIRectCornerBottomRight = 1 << 3,
// UIRectCornerAllCorners = ~0UL
// 设置指定角的有圆角效果
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(20, 20)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view.bounds;
// maskLayer.masksToBounds = YES;
maskLayer.borderColor = [UIColor blackColor].CGColor;
maskLayer.path = maskPath.CGPath;
view.layer.mask = maskLayer;
// Do any additional setup after loading the view, typically from a nib.
}
0 0
- iOS 设置视图的圆角效果
- iOS高效的设置圆角效果
- iOS 视图的模糊效果
- CAGradientlayer设置视图背景的渐变效果
- iOS 视图实现圆角效果的三种方法及比较
- iOS 设置头像圆角效果
- iOS-设置阴影和圆角效果
- ios视图切换效果
- ios视图切换效果
- iOS视图动画效果
- iOS 指定视图的圆角、label、button圆角设置
- iOS-设置视图圆角样式流畅解决方案
- ios:设置视图背景图片的方法
- ios:设置视图背景图片的方法
- iOS-设置视图的边框
- 视图圆角设置
- iOS view圆角设置同时又不影响子视图超出父视图部分显示
- iOS 设置视图圆角宏
- bzoj 2118: 墨墨的等式
- gdb调试应用程序
- 拉链法(链地址法)
- LVS DR/NAT/FULLNAT/TUNNEL模式介绍
- App.Config操作
- iOS 设置视图的圆角效果
- 数轴上一个点到其他点距离之和最小问题
- Hibernate二级缓存 的配置详解(ssh)
- EL表达式 自定义方法 tld 说明
- 类,对象的初始化
- java实现发送邮件
- OpenCV学习之CvMat的用法详解及实例
- [leetcode] 152. Maximum Product Subarray
- MySQL锁阻塞分析