How does the alertController of ios display to the front?

I show the alertController, by clicking a button in a view, but it is obscured by the view. How can I make the alert prompt box appear at the front? -sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

May.06,2021

two reasons cannot be displayed:

  1. your view is added in front of alertController.
  2. you are using alert in the wrong way.

the first reason, you can run it, click the UI debug button, you can see the sequential position of each view, and you will know if view is blocking the front. If it is blocked, the way you add view will have to be changed.
for the second reason, here is a reference for the use of alertController.

let alertController = UIAlertController(title: title, message: alertMessage, preferredStyle: .alert)
        let cancelAction = UIAlertAction(title: cancleTitle, style: .cancel, handler: nil)
        alertController.addAction(cancelAction)
        presenter?.present(alertController, animated: true, completion: nil)
Menu