I know I have to set the delegate (I did so like this: class ShiftOverview: UITableViewController, UIActionSheetDelegate {...
) but I'm still getting no response when I tap the buttons.
It doesn't look like you can set the delegate within the function with UIAlertController
either...
@IBAction func takeShift(sender: AnyObject) {
let myActionSheet = UIAlertController (title: "Confirm", message: "Test message", preferredStyle: UIAlertControllerStyle.ActionSheet)
let actionOne = UIAlertAction (title: "Take Shift", style: .Default, handler: nil)
let actionTwo = UIAlertAction (title: "View ESA", style: .Default, handler: nil)
let actionCancel = UIAlertAction (title: "Cancel", style: .Cancel, handler: nil)
myActionSheet.addAction(actionOne)
myActionSheet.addAction(actionTwo)
myActionSheet.addAction(actionCancel)
self.presentViewController(myActionSheet, animated: true, completion: nil)
}
func actionSheet (myActionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int)
{
switch buttonIndex {
case 0:
println ("test0")
break
case 1:
println ("test1")
break
case 2:
println ("test2")
break
default:
println("nope")
}
}