Swift 4.0 设置阴影和圆角 (UIBezierPath)
2017-11-09 17:48
1341 查看
self.layer.masksToBounds =
false;
self.layer.contentsScale =
UIScreen.main.scale;
self.layer.shadowOpacity =
0.3;
self.layer.shadowRadius =
2.0;
self.layer.shadowOffset =
CGSize.init(width:
0, height: 0);
self.layer.shadowPath =
UIBezierPath.init(roundedRect:
self.bounds, cornerRadius: 5).cgPath;
//设置缓存
self.layer.shouldRasterize =
true;
//设置抗锯齿边缘
self.layer.rasterizationScale =
UIScreen.main.scale;
false;
self.layer.contentsScale =
UIScreen.main.scale;
self.layer.shadowOpacity =
0.3;
self.layer.shadowRadius =
2.0;
self.layer.shadowOffset =
CGSize.init(width:
0, height: 0);
self.layer.shadowPath =
UIBezierPath.init(roundedRect:
self.bounds, cornerRadius: 5).cgPath;
//设置缓存
self.layer.shouldRasterize =
true;
//设置抗锯齿边缘
self.layer.rasterizationScale =
UIScreen.main.scale;
相关文章推荐
- Swift-UIStoryboard & Xib 实时设置控件圆角、边框、阴影
- 页面间的跳转动画,及给tableView cell设置阴影和圆角
- Swift - 设置tableView每个分区cell圆角
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- Swift用UIBezierPath来画圆角矩形、自定义多路径图形
- Swift用UIBezierPath来画圆角矩形、自定义多路径图形
- swift设置圆角
- 给UIImage 设置圆角 阴影
- swift----设置图片圆角
- iOS-设置阴影和圆角效果
- 黄聪:CSS+DIV 设置圆角边框加阴影效果
- CSS 设置圆角div和阴影效果
- 转载:view 设置阴影+圆角
- UIView设置圆角、边框和阴影
- iOS设置圆角矩形和阴影效果
- iOS 设置圆角阴影,避免离屏渲染 —— HERO博客
- iOS Swift3.0异步设置任意弧度高性能圆角图片
- IOS 创建圆角矩形按钮及设置阴影等其他属性
- Swift3.0 UIImage设置圆角无效
- 设置圆角,圆形图像,阴影部分