豆瓣电台笔记

1、设置圆形图片并且边界有4个大小的模糊

1)指定当前图片组件剪切边界为true
self.clipsToBounds = true
2)指定当前层圆角半径
self.layer.cornerRadius = self.frame.size.width/2

3) 指定边界宽度
self.layer.borderWidth = 4
4) 指定边界颜色
self.layer.borderColor = UIColor(red:1.0,green:1.0,blue:1.0,alpha:0.7).CGColor

 

2、设置旋转动画

func onRotation(){

//1、创建一个动画,并指定keyPath为旋转
  let  animation = CGBasicAnimation(keyPath:"transform.rotation")
//2、指定动画的开始和结束角度,其中M_PI是∏
    animation.fromValue = 0.0
    animation.toValue = M_PI * 2.0  
//3、指定动画执行时间和重复次数
    animation.duration = 20
    animation.repeatCount = 10000
//4、将动画添加到当前的视图层
    self.layer.addAnimation(animation,forkey:nil)  

}

 

3、设置背景图片模糊

1、创建模糊效果
let blurEffect = UIBlurEffect(.Light)
2、创建承载模糊效果的图层
let visualEffectView = UIVisualEffectView(blurEffect)
3、指定模糊图层的覆盖区域
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、设置表格及单元格模糊

 

self.tableView.backgroundColor = UIColor.clearColor()

cell.backgroundColor = UIColor.clearColor()

 

5、设置弹出层的页面透明度(可以看到下面的图层)

self.view.alpha = 0.8

  

  

 

posted @ 2016-04-13 14:04  GrandKai  阅读(184)  评论(0)    收藏  举报