1. 设置页面的代理
class SecondViewController: TFBaseViewController,UIActionSheetDelegate {
2. 源码//底部警告框 func testUIActionSheet() { let actionSheet = UIActionSheet() actionSheet.addButtonWithTitle("取消") actionSheet.addButtonWithTitle("确定") actionSheet.addButtonWithTitle("选择") actionSheet.cancelButtonIndex = 0 actionSheet.delegate = self actionSheet.showInView(self.view) } func actionSheet(actionSheet: UIActionSheet,didDismissWithButtonIndex buttonIndex: Int){ print("您点击了:"+actionSheet.buttonTitleAtIndex(buttonIndex)!) }原文链接:https://www.f2er.com/swift/323845.html