How to achieve a semi transparent background in an app for iOS made with Xcode? (Type iBooks)

1

my question is how it is achieved (if it can be done) that the background of the app that is being created in Xcode (Swift) is semi transparent. Something similar to iBooks on iOS that when opened does not show a white background but shows the wallpaper of the iOS device in a diffused way. So that if the wallpaper is green the app looks green and above the books are shown or if it is red the red background is shown etc. etc.

- annex some images of iBooks on iOS to denote what I describe in the question -

] 2

    
asked by Jesùs Martinez 04.04.2018 в 03:21
source

1 answer

1

You can find the answer here: link

let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectView)

This code applies a "semi transparent" window to view. Therefore, all you need is to have an image or the background you want to transparent in view. You have different types of transparent effects in UIBlurEffectStyle. You can also change the alpha of the transparency in UIVisualEffectView even if the documentation does not advise it.

    
answered by 20.04.2018 в 09:35