测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布日期最后发布 | 2016 年 10 月 |
SPM支持 SPM | ✗ |
由 Wei Zhao 维护。
CPAlertViewController 是用 Swift 编写的自定义 Alert View Controller。
灵感来自出色的 SweetAlert-iOS 和 SCLAlertView-Swift。区别在于 CPAlertViewController 使用了自动布局。
将 Classes/*.swift
拷贝到您的项目中是安装此库的最简单方法。
这些属性是全局的,作用于整个项目。
/// The font size of tittle
public static var titleFontSize: CGFloat = 22.0
/// The font size of message
public static var messageFontSize: CGFloat = 16.0
/// The font size of button
public static var buttonFontSize: CGFloat = 16.0
/// The text color of tittle
public static var titleColor = UIColor.colorFromRGB(0x333333)
/// The text color of message
public static var messageColor = UIColor.colorFromRGB(0x555555)
/// The text color of button
public static var buttonTitleColor = UIColor.whiteColor()
/// The normal background color of button
public static var buttonBGNormalColor = UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0)
/// The highlighted background color of button
public static var buttonBGHighlightedColor = UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 0.7)
指定方法
public func show(title title: String?, message: String?, style: CPAlertStyle = .None, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
CPAlertViewController 还提供了四个便利方法
显示成功
public func showSuccess(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
显示错误
public func showError(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
显示警告
public func showWarning(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
显示信息
public func showInfo(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
Swift 3.0+
Xcode 8.0+
在 MIT 许可证下发布。请在 LICENSE 中查看详细信息。