I'm using UIBlurEffect
from UIVisualEffectView
to produce the look introduced in iOS 7. To do so I programmatically add anything I want portrayed on top of the blur to the contentView
, as described in the UIBlurEffect
Class Reference:
A
UIBlurEffect
object applies a blurring effect to the content layered behind aUIVisualEffectView
. Views added to thecontentView
of aUIVisualEffectView
are not affected by the blur effect.
But now I need to add a UIScrollView
into the mix, and the fact that I had to use the contentView
has left me completely confused. I'm not very familiar with the UIScrollView
, but the iOS 8 Swift Programming Cookbook gives this example:
I'm not in need of displaying an imageView
, but instead a separate view
with many views inside of it in the hierarchy. Where exactly do I add the scrollView
? Do I set scrollView
as a subview
of contentView
? Or the other way around, the contentView
as a subview
of scrollView
? Here's my current code:
class InfoVC: UIViewController {
@IBOutlet weak var contentView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// blur
let blur = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
blur.frame = view.frame
view.addSubview(blur)
blur.contentView.addSubview(self.contentView)
}