Interesting and colorful Alert style--iOS OC&Swift炫酷的可编辑弹窗(AlertController/Alert)
Made by InitialC
Module | Address | Version | Date | Author |
---|---|---|---|---|
ZWAlert&ZWAlertController | https://github.com/Initial-C/ZWAlertController.git | 0.3.0 | 2019.04.18 | Initial-C |
Swift 3.x请使用0.0.8.6
Swift 4.0请使用0.2.0以上版本
Swift 5.0请使用0.3.0以上版本
0.0.3 version were updated something about limit characters, it can limit the input of Chinese and English Emoji more precisely
0.0.3 版本已支持ZWAlertController弹出文本输入框下的中英文emoji混输 以及完美支持emoji字符数限制
0.1.2 版本新增方块样式, 可以在初始化时使用.customActionSheet
0.1.2 version of the new custom style, you can use.CustomActionSheet at initialization
0.2.0 版本新增简约卡片弹窗样式, 可以在初始化时使用.simplify和CustomCardSheet样式
0.2.0 version of the new simplify style, you can use.simplify at initialization
0.3.0 优化并增加支持Swift5.0
0.3.0 Upgrade to Swift 5
To run the example project, clone the repo, and run pod install
from the Example directory first.
Simple Alert View written in Swift, which can be used as a UIAlertController replacement.
It supports from iOS7! It is simple and easily customizable!
ZWAlertController can be used as a UIAlertController
.
// Set title, message and alert style
let alertController = ZWAlertController(title: "title", message: "message", preferredStyle: .Alert)
// Create the action.
let cancelAction = ZWAlertAction(title: "Cancel", style: .Cancel, handler: nil)
// You can add plural action.
let okAction = ZWAlertAction(title: "OK" style: .Default) { action in
NSLog("OK action occured.")
}
// Add the action.
alertController.addAction(cancelAction)
alertController.addAction(okAction)
// Show alert
presentViewController(alertController, animated: true, completion: nil)
alertController.addTextFieldWithConfigurationHandler { textField in
// text field(UITextField) setting
// ex) textField.placeholder = "Password"
// textField.secureTextEntry = true
}
alertController.textLimit = 20 // you can limit str length for Chinese or English character, base for English character range
alertController.overlayColor = UIColor(red:235/255, green:245/255, blue:255/255, alpha:0.7)
alertController.alertViewBgColor = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
alertController.titleFont = UIFont(name: "GillSans-Bold", size: 18.0)
alertController.titleTextColor = UIColor(red:241/255, green:196/255, blue:15/255, alpha:1)
alertController.messageFont = UIFont(name: "GillSans-Italic", size: 15.0)
alertController.messageTextColor = UIColor.whiteColor()
alertController.buttonFont[.Default] = UIFont(name: "GillSans-Bold", size: 16.0)
alertController.buttonTextColor[.Default] = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
alertController.buttonBgColor[.Default] = UIColor(red: 46/255, green:204/255, blue:113/255, alpha:1)
alertController.buttonBgColorHighlighted[.Default] = UIColor(red:64/255, green:212/255, blue:126/255, alpha:1)
// Default style : [.Default]
// Cancel style : [.Default] → [.Cancel]
// Destructive style : [.Default] → [.Destructive]
ZWAlertController is available through CocoaPods.
To install add the following line to your Podfile:
pod 'ZWAlertController'
This software is released under the MIT License, see LICENSE.txt.
Initial-C-William Chang, iwilliamchang@outlook.com
ZWAlertController is available under the MIT license. See the LICENSE file for more info.