Reputation: 7537
I want to make a form sheet, presented modally, partially transparent, similar to how the volume meter or control center is partially transparent in iOS 7+.
I am programming using XCode 6.3.2, Swift 1.2, and it is for an iOS 8 platform (iPad).
I tried the following:
Setting the ViewController's alpha value in Storyboard to 0.5
Background color result appears darker, but not see-through, text appears faint.
Setting background color in Storyboard to "Clear Color"
Background color appears darker, did not notice fainter text.
Setting background color to a color with 30% transparency
Similar to above.
De - selecting
Clears Graphics Content
No noticeable change to end result.
To clarify, I want a partially see-through modal view on iPad, not a darker background.
Is there any way to do this, in Swift or in the Storyboard?
Upvotes: 0
Views: 1273
Reputation: 187
Rocket101, here's code I use to achieve a similar effect. It is in Objective C but you should be able to translate it easily. During login I block my current view with "coverView" which presents a blurred logo. In your case you would not include the "backgroundImage". Here is how I create the blurred effect.
UIView *coverView = [[UIView alloc] init];
coverView.frame = self.tabBarController.view.bounds;
UIImage *backgroundImage = [UIImage imageNamed:@"SomeBackgroundImage"];
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];
backgroundView.frame = self.tabBarController.view.bounds;
UIVisualEffect *blurEffect;
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
effectView.frame = self.tabBarController.view.bounds;
effectView.alpha = 0.8;
[coverView addSubview:backgroundView];
[coverView addSubview:effectView];
[coverView sendSubviewToBack:effectView];
[coverView sendSubviewToBack:backgroundView];
[theView addSubview:coverView];
Upvotes: 2