It is the one that displays like an image. It comes out often, so I will summarize it this time.
The title of the alert and its contents are assigned to the constant dialog. Then add the action with addAction in the dialog. The additional content is the OK part of the image. Finally, self.present will display the alert you just created.
let alert = UIAlertController(title: "title", message: "message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
This time I wrote about an alert with one option. I will also write about other types.
Recommended Posts