let alertView = UIAlertView() alertView.title = "系统提示" alertView.message = "您确定要离开hangge.com吗?" alertView.addButtonWithTitle("取消") alertView.addButtonWithTitle("确定") alertView.cancelButtonIndex=0 alertView.delegate=self; alertView.show() func alertView(alertView:UIAlertView,clickedButtonAtIndex buttonIndex: Int){ if(buttonIndex==alertView.cancelButtonIndex){ print("点击了取消") } else { print("点击了确认") } }
原文链接:https://www.f2er.com/swift/324592.html