豆瓣电台笔记
1、設(shè)置圓形圖片并且邊界有4個(gè)大小的模糊
1)指定當(dāng)前圖片組件剪切邊界為true self.clipsToBounds = true 2)指定當(dāng)前層圓角半徑 self.layer.cornerRadius = self.frame.size.width/23) 指定邊界寬度 self.layer.borderWidth = 4 4) 指定邊界顏色 self.layer.borderColor = UIColor(red:1.0,green:1.0,blue:1.0,alpha:0.7).CGColor?
2、設(shè)置旋轉(zhuǎn)動畫
func onRotation(){//1、創(chuàng)建一個(gè)動畫,并指定keyPath為旋轉(zhuǎn)let animation = CGBasicAnimation(keyPath:"transform.rotation") //2、指定動畫的開始和結(jié)束角度,其中M_PI是∏animation.fromValue = 0.0animation.toValue = M_PI * 2.0 //3、指定動畫執(zhí)行時(shí)間和重復(fù)次數(shù)animation.duration = 20animation.repeatCount = 10000 //4、將動畫添加到當(dāng)前的視圖層self.layer.addAnimation(animation,forkey:nil) }?
3、設(shè)置背景圖片模糊
1、創(chuàng)建模糊效果 let blurEffect = UIBlurEffect(.Light) 2、創(chuàng)建承載模糊效果的圖層 let visualEffectView = UIVisualEffectView(blurEffect) 3、指定模糊圖層的覆蓋區(qū)域 visualEffectView.frame.size = CGSize(width:self.view.frame.size.width,height:self.view.frame.size.height) 或者 visualEffectView.frame.size = self.view.frame.size 4、將模糊圖層添加到背景圖片上 bg.addSubView(visualEffectView)?
4、設(shè)置表格及單元格模糊
?
self.tableView.backgroundColor = UIColor.clearColor()cell.backgroundColor = UIColor.clearColor()?
5、設(shè)置彈出層的頁面透明度(可以看到下面的圖層)
self.view.alpha = 0.8
?
轉(zhuǎn)載于:https://www.cnblogs.com/sallet/p/5386928.html
總結(jié)
- 上一篇: vue实现带图片的标题栏
- 下一篇: 让你的win10流畅起来,只需几个优化小