-
Notifications
You must be signed in to change notification settings - Fork 0
ActionSheet 1
Mohammad Azmal Hossain edited this page Mar 6, 2017
·
3 revisions
import UIKit
class MainViewController: UIViewController, UIActionSheetDelegate {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.gray
// Create the AlertController and add its actions like button in ActionSheet let actionSheetController = UIAlertController(title: "Please select", message: "Option to select", preferredStyle: .actionSheet)
let cancelActionButton = UIAlertAction(title: "Cancel", style: .cancel) { action -> Void in
print("Cancel")
}
actionSheetController.addAction(cancelActionButton)
let saveActionButton = UIAlertAction(title: "Save", style: .default) { action -> Void in
print("Save")
}
actionSheetController.addAction(saveActionButton)
let deleteActionButton = UIAlertAction(title: "Delete", style: .default) { action -> Void in
print("Delete")
}
actionSheetController.addAction(deleteActionButton)
self.present(actionSheetController, animated: true, completion: nil)
}
}