我想在視圖控制器的視圖背景中使用模糊效果但有時它不起作用,當它工作時它將無法正常工作,當我在大型熨平板設備上運行程序時喜歡iPad有上頂部的黑色方塊,我無法看到的模糊效果模糊按鈕效果
這裏是我的代碼
class sahafiViewController: UIViewController , UIImagePickerControllerDelegate , UINavigationControllerDelegate {
@IBOutlet weak var backgroundImg: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = backgroundImg.bounds
backgroundImg.addSubview(blurView)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}}
不工作:(頁面將不會被模糊這將是完全黑 –