I\'d like to create a pop-up menu similar to the one found in the mail app when you want to reply to a message. I\'ve seen this in more than one application so I wasn\'t su
To everybody who is looking for a solution in Swift:
Adopt UIActionSheetDelegate
protocol
Create and show the ActinSheet:
let sheet: UIActionSheet = UIActionSheet()
sheet.addButtonWithTitle("button 1")
sheet.addButtonWithTitle("button 2")
sheet.addButtonWithTitle("button 3")
sheet.addButtonWithTitle("Cancel")
sheet.cancelButtonIndex = sheet.numberOfButtons - 1
sheet.delegate = self
sheet.showInView(self.view)
The delegate function:
func actionSheet(actionSheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int){
switch buttonIndex{
case 0:
NSLog("button1");
case 1:
NSLog("button2");
case 2:
NSLog("button3");
case actionSheet.cancelButtonIndex:
NSLog("cancel");
break;
default:
NSLog("blub");
break;
}
}