What you need to implement is actually called UIAlertController:
func displayAlertMenu() {
let alert = UIAlertController(title: "Selecione a origem", message: nil, preferredStyle: .actionSheet)
let cameraAction = UIAlertAction(title: "Tirar Foto ou Filmar Video", style: .default) {
action in
// call display camera method
}
let galleryAction = UIAlertAction(title: "Escolher Foto Existente", style: .default) {
action in
// call display gallery method
}
let cancelAction = UIAlertAction(title: "Cancelar", style: .cancel) {
action in
print("user tapped the cancel button")
}
alert.addAction(cameraAction)
alert.addAction(galleryAction)
alert.addAction(cancelAction)
present(alert, animated: true, completion: nil)
}
And call the method when your view appears or at the push of a button:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
displayAlertMenu()
}