如何在PageViewController中通过滑动维护UIBlurEffect?

时间:2015-11-17 01:13:23

标签: ios uipageviewcontroller uiblureffect

我在UIBlurEffect上显示的VC上实现了PageViewController,但是当你向左滑动VC时,新VC从右边出现在屏幕上(带有模糊效果)离开的VC失去了它的模糊效果。有没有办法可以保持效果,直到它完全消失? (下面是我的SinglePageViewController的相关代码)

override func viewDidLoad() {
        super.viewDidLoad()

        if let url  = NSURL(string: imageURL!), data = NSData(contentsOfURL: url) { //TODO: unwrap optional
            image.image = UIImage(data: data)

        }

        backgroundImage = UIImageView(image: UIImage(named: backgroundImageName!))
        backgroundImage.contentMode = UIViewContentMode.ScaleAspectFill
        self.view.insertSubview(backgroundImage, atIndex: 0)

        // 1
        let blurEffect = UIBlurEffect(style: .Light)
        // 2
        let blurView = UIVisualEffectView(effect: blurEffect)
        // 3
        blurView.frame = backgroundImage.bounds
        blurView.alpha = 0.9

        self.view.insertSubview(blurView, atIndex: 1)
}

0 个答案:

没有答案