封装了 UIAlertView,简单易用,支持 Block 回调,丢弃各种 tag。
您可以使用 CocoaPods 安装 ZKAlertView
,在您的 Podfile
中添加:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'ZKAlertView'
end
ZKAlertView
文件夹拖动到您的项目ZKAlertView
import ZKAlertView
ZKAlertView.show(message: "不显示标题,显示一个按钮", buttonTitle: "确定")
ZKAlertView.show("标题", message: "显示标题,显示一个按钮", buttonTitle: "确定")
ZKAlertView.show(message: "不显示标题,显示一个按钮,包含回调", buttonTitle: "确定") {
print("不显示标题,显示一个按钮,包含回调")
}
ZKAlertView.show("标题", message: "显示标题,显示一个按钮,包含回调", buttonTitle: "确定") {
print("不显示标题,显示一个按钮,包含回调")
}
ZKAlertView.show(message: "不显示标题,显示多个按钮,包含回调", cancleButtonTitle: "取消", otherButtonTitles: "按钮1", "按钮2") { (alertView, buttonIndex) in
print("按钮点击索引:\(buttonIndex)")
}
ZKAlertView.show("标题", message: "显示标题,显示多个按钮,包含回调", cancleButtonTitle: "取消", otherButtonTitles: "按钮1", "按钮2") { (alertView, buttonIndex) in
print("按钮点击索引:\(buttonIndex)")
}