I want to add a subview to my alertcontroller. But why do the buttons go on the top ? How do I fix the problem?
let alert = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.alert)
let somethingAction = UIAlertAction(title: "Something", style: .default, handler: {(alert: UIAlertAction!) in print("something")})
let cancelAction = UIAlertAction(title: "Annuler", style: .cancel, handler: {(alert: UIAlertAction!) in print("cancel")})
alert.addAction(somethingAction)
alert.addAction(cancelAction)
let customView = UIView()
customView.backgroundColor = .green
customView.translatesAutoresizingMaskIntoConstraints = false
customView.widthAnchor.constraint(equalToConstant: 128).isActive = true
customView.heightAnchor.constraint(equalToConstant: 128).isActive = true
alert.view.addSubview(customView)
customView.centerXAnchor.constraint(equalTo: alert.view.centerXAnchor).isActive = true
customView.topAnchor.constraint(equalTo: alert.view.topAnchor).isActive = true
customView.bottomAnchor.constraint(equalTo: alert.view.bottomAnchor, constant: -32).isActive = true
self.present(alert, animated: true, completion:{})