Blur effect that appears in the simulator, but not on the iPhone
I wanted to create a blur effect UIImageView
using the code below. The problem is I can see BlurEffect when I run it in the Simulator, but not when I plug in my iPhone, I only see a gray background here ... any ideas? Here is the code I used:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
self.myImageView.image = UIImage(named: "Desert.png")
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame.size = CGSize(width: 375, height: 667)
blurView.center = myImageView.center
self.myImageView.addSubview(blurView)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
I am running Xcode 6.1.1 (also tried Xcode 6.2!) And my iPhone is 8.1.2
+3
source to share