1, create an action table below (or call the bottom warning box) and pop up the display
| 123456789101112131415161718 |
class ViewController: UIViewController,UIActionSheetDelegate { override func viewDidLoad() { super.viewDidLoad() var actionSheet=UIActionSheet() //actionSheet.title = "请选择操作" actionSheet.addButtonWithTitle("取消") actionSheet.addButtonWithTitle("动作1") actionSheet.addButtonWithTitle("动作2") actionSheet.cancelButtonIndex=0 actionSheet.delegate=self actionSheet.showInView(self.view); } func actionSheet(actionSheet: UIActionSheet!,clickedButtonAtIndex buttonIndex:Int){ println("点击了:"+actionSheet.buttonTitleAtIndex(buttonIndex)) }} |
2, in the general case, the tool bar, or the label bar display in the way the call is not the same
| 123 |
actionSheet.showInView(self.view); //一般情况actionSheet.showFromToolbar(self.navigationController.toolbar) //工具条的情况下actionSheet.showFromTabBar(self.tabBar) //标签条的情况下 |
Swift-action table (Uiactionsheel) usage, also called bottom warning box