Advertisement
thieumao

Show Action Sheet

May 12th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.52 KB | None | 0 0
  1. import UIKit
  2.  
  3. class YeuThichViewController: UIViewController {
  4.  
  5.     override func viewDidLoad() {
  6.         super.viewDidLoad()
  7.  
  8.         // Do any additional setup after loading the view.
  9.     }
  10.  
  11.     override func didReceiveMemoryWarning() {
  12.         super.didReceiveMemoryWarning()
  13.         // Dispose of any resources that can be recreated.
  14.     }
  15.    
  16.     @IBAction func showActionSheet(sender: AnyObject) {
  17.         let optionMenu = UIAlertController(title: nil, message: "Choose option", preferredStyle: .ActionSheet)
  18.  
  19.         let actionDelete = UIAlertAction(title: "Delte", style: .Default) { (action) in
  20.             print("File Delete")
  21.         }
  22.         let actionSave = UIAlertAction(title: "Save", style: .Default) { (action) in
  23.             print("File Save")
  24.         }
  25.         let actionCancel = UIAlertAction(title: "Cancel", style: .Cancel) { (action) in
  26.             print("Action Cancel")
  27.         }
  28.        
  29.         optionMenu.addAction(actionDelete)
  30.         optionMenu.addAction(actionSave)
  31.         optionMenu.addAction(actionCancel)
  32.         self.presentViewController(optionMenu, animated: true, completion: nil)
  33.     }
  34.  
  35.     /*
  36.     // MARK: - Navigation
  37.  
  38.     // In a storyboard-based application, you will often want to do a little preparation before navigation
  39.     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  40.         // Get the new view controller using segue.destinationViewController.
  41.         // Pass the selected object to the new view controller.
  42.     }
  43.     */
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement