-
-
Save dereksee/ee012cc65c9f8f8eb245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// | |
import UIKit | |
class ViewController: UIViewController, UIActionSheetDelegate { | |
@IBAction func tapButton(sender : AnyObject) { | |
var sheet: UIActionSheet = UIActionSheet(); | |
let title: String = "Please choose a course"; | |
sheet.title = title; | |
sheet.delegate = self; | |
sheet.addButtonWithTitle("Cancel"); | |
sheet.addButtonWithTitle("A course"); | |
sheet.addButtonWithTitle("B course"); | |
sheet.addButtonWithTitle("C course"); | |
sheet.cancelButtonIndex = 0; | |
sheet.showInView(self.view); | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
func actionSheet(sheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int) { | |
println("index %d %@", buttonIndex, sheet.buttonTitleAtIndex(buttonIndex)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment