2

I want to implement the blurred background image in iWatch app. Watchkit. Many apps like TuneIn implement this. There are some answers giving adding a blur view but watchkit does not support addsubview.

TuneIn app shows this effect: https://itunes.apple.com/us/app/tunein-radio/id418987775

I want to implement something like this.

Please help! Thanks in advance! Any suggestions will be highly appreciated.

Giaaa Ag
  • 47
  • 3

2 Answers2

0

Try below,

//only apply the blur if the user hasn't disabled transparency effects
if !UIAccessibilityIsReduceTransparencyEnabled() {
    let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
    let blurEffectView = UIVisualEffectView(effect: blurEffect)
    blurEffectView.frame = view.bounds //view is self.view in a UIViewController
    view.addSubview(blurEffectView)
    //if you have more UIViews on screen, use insertSubview:belowSubview: to place it underneath the lowest view

    //add auto layout constraints so that the blur fills the screen upon rotating device
    blurEffectView.setTranslatesAutoresizingMaskIntoConstraints(false)
} else {
    view.backgroundColor = UIColor.blackColor()
}
Nilesh Patel
  • 6,318
  • 1
  • 26
  • 40
0

They do this by blurring the image on the phone before sending it over to the Watch.

Jordi Bruin
  • 1,588
  • 1
  • 11
  • 20