Skip to content

Instantly share code, notes, and snippets.

@bumaociyuan
Last active June 27, 2016 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bumaociyuan/af36dbfedc9e4509fcf831ffb6468096 to your computer and use it in GitHub Desktop.
Save bumaociyuan/af36dbfedc9e4509fcf831ffb6468096 to your computer and use it in GitHub Desktop.
blur present viewcontroller
let vc = CustomViewController()
vc.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve
vc.modalPresentationStyle = UIModalPresentationStyle.OverFullScreen
presentViewController(vc, animated: true, completion: nil)
// in CustomViewController
override func viewDidLoad() {
super.viewDidLoad()
let lightEffect = UIBlurEffect(style: .Light)
let lightView = UIVisualEffectView(effect: lightEffect)
view.addSubview(lightView)
lightView.snp_makeConstraints { (make) in
make.edges.equalTo(view)
}
let darkEffect = UIBlurEffect(style: .Dark)
let darkView = UIVisualEffectView(effect: darkEffect)
view.addSubview(darkView)
darkView.snp_makeConstraints { (make) in
make.edges.equalTo(view)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment