相关疑难解决方法(0)

模糊效果在模拟器中显示,但在 iPhone 上不显示

UIImageView我想用下面的代码创建模糊效果。问题是,当我在模拟器中运行它时,我可以看到 BlurEffect,但当我连接 iPhone 时却看不到,这里我只能看到灰色背景......有什么想法吗?这是我使用的代码:

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.
}


}
Run Code Online (Sandbox Code Playgroud)

我正在 Xcode 6.1.1 上运行(也尝试过 Xcode 6.2!),我的 iPhone 操作系统是 8.1.2

iphone xcode ios swift

3
推荐指数
1
解决办法
1055
查看次数

标签 统计

ios ×1

iphone ×1

swift ×1

xcode ×1