I want to create a custom Alert
. So I inserted a content UIView
with some width and height and the remaining area I want to look dim.
Below ideas I've tried but no luck
1- In Storyboard
I set background custom color black and opacity
35%. But After a few second background is turning black.
2- Also tried to set background opacity in UIViewController
by using below code, but not working.
view.backgroundColor = UIColor.black.withAlphaComponent(0.35)
any help would be appreciated. Thanks in advance
I would like to share what worked for me. I am using
Xcode 10.3
andSwift 5
Step 1- In
Storyboard
I setUIView
background custom color black andopacity 35%
.Step 2- Presented the
ViewController
using the bellow chunk of code.