CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2016 |
SPMSupports SPM | ✗ |
Maintained by Wei Zhao.
CPAlertViewController is custom Alert View Controller written in Swift.
Inspired by the excellent SweetAlert-iOS and SCLAlertView-Swift. The difference is that CPAlertViewController uses auto layout.
The simplest way to install this library is to copy Classes/*.swift
to your project.
These properties is global and applied to the whole project.
/// 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)
The designated method
public func show(title title: String?, message: String?, style: CPAlertStyle = .None, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
CPAlertViewController also provides four convenience methods
Show success
public func showSuccess(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
Show error
public func showError(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
Show warning
public func showWarning(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
Show info
public func showInfo(title title: String?, message: String?, buttonTitle: String = "OK", otherButtonTitle: String? = nil, action: UserAction? = nil)
Swift 3.0+
Xcode 8.0+
Released under the MIT license. See LICENSE for details.