I am presenting a view controller modally (transparent) and then trying to add a dialogue box as a subview with a few buttons. I would like this subview to be solid colour however and not transparent, but can't get it to work.
I have tried setting the alpha of the subview to 1 but it's not changing the appearance.
class GameOverViewController: UIViewController {
private let restart = UIButton(type: .custom)
private let mainmenu = UIButton(type: .custom)
override func viewDidLoad() {
//displays view controller modally
super.viewDidLoad()
self.view.backgroundColor = .white
self.view.alpha = 0.6
self.modalPresentationStyle = .overCurrentContext
//add dialogue box
let dialoguebox = UIView(frame: CGRect(origin: CGPoint(x: self.view.frame.width / 2, y: self.view.frame.height / 2), size: CGSize(width: self.view.frame.width / 2, height: self.view.frame.height / 2)))
dialoguebox.backgroundColor = .red
dialoguebox.center = self.view.center
dialoguebox.alpha = 1
self.view.addSubview(dialoguebox)
}
}