UBAlertView
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
要求
安装
UBAlertView 可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile 中
pod 'UBAlertView'
用途
import UBAlertView
在需要显示警报的地方写入以下代码
func showAlert(){
let AlertViews = UBAlertViews()
AlertViews.ShowSuccessAlert(_AlertBackgroundColor: .black, "SALAD 50% OFF", .white,"HelveticaNeue", "Special offer for you.you can redeem this coupon now.offer will expire soon", .white,"HelveticaNeue-Thin", UIImage.init(named: "salad")!, ButtonTitle: "Check In", ButtonBackgroundColor: #colorLiteral(red: 0.2745098174, green: 0.4862745106, blue: 0.1411764771, alpha: 1),DismissButtonImage:UIImage.init(named: "Dismiss")!)
self.view.addSubview(AlertViews)
}
下面可以看到主函数。
public func ShowSuccessAlert(_AlertBackgroundColor:UIColor,_ title:String,_ titleTextColor : UIColor,_ titleFontName:String,_ Description:String,_ DescriptionTextColor:UIColor,_ DescriptionFontName:String, _ Alertimage:UIImage,ButtonTitle:String,ButtonBackgroundColor: UIColor,DismissButtonImage:UIImage)
为 AlertView 按钮添加操作
AlertViews.MyButtonAction = {
//do something with AlertButton
print("Button pressed.")
}
作者
UdayKumar97,[email protected]
许可
UBAlertView 在MIT许可下可用。有关更多信息,请参阅LICENSE文件。