1.新建actionSheet
var actionSheet = UIActionSheet (title: "title", delegate: self, cancelButtonTitle: "取消", destructiveButtonTitle: "登出", otherButtonTitles: "在等一下", "等一次")
actionSheet.showInView(self.view)
2.遵守协议
class RootViewController: UIViewController,UIActionSheetDelegate { //协议
3.回调函数
func actionSheetCancel(actionSheet: UIActionSheet) {// 点击取消按钮回调函数
}
func actionSheet(actionSheet: UIActionSheet, willDismissWithButtonIndex buttonIndex: Int) {
// 将要消失回调函数
}
func actionSheet(actionSheet: UIActionSheet, didDismissWithButtonIndex buttonIndex: Int) {
// 已经消失回调函数
}
func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
// 点击按钮回调函数 返回的是按钮的索引值
}