项目作者: Initial-C

项目描述 :
Interesting and colorful Alert style--iOS OC&Swift炫酷的可编辑弹窗(AlertController/Alert)
高级语言: Swift
项目地址: git://github.com/Initial-C/ZWAlertController.git
创建时间: 2016-12-20T10:27:32Z
项目社区:https://github.com/Initial-C/ZWAlertController

开源协议:MIT License

下载


ZWAlertController

Build
Version
Language
Platform
License
Jianshu

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

⚠️ To use with Swift 3.x please ensure you are using == 0.0.8.6 ⚠️

⚠️ To use with Swift 4.x please use above 0.2.0 version ⚠️

⚠️ To use with Swift 5.x please use above 0.3.0 version ⚠️

Swift 3.x请使用0.0.8.6

Swift 4.0请使用0.2.0以上版本

Swift 5.0请使用0.3.0以上版本

Example

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.

Requirements

ZWAlertController

Simple Alert View written in Swift, which can be used as a UIAlertController replacement.
It supports from iOS7! It is simple and easily customizable!

NewCustomForSheetStyle
AlertStyle
SheetStyle
ZWAlert

Easy to use

ZWAlertController can be used as a UIAlertController.

  1. // Set title, message and alert style
  2. let alertController = ZWAlertController(title: "title", message: "message", preferredStyle: .Alert)
  3. // Create the action.
  4. let cancelAction = ZWAlertAction(title: "Cancel", style: .Cancel, handler: nil)
  5. // You can add plural action.
  6. let okAction = ZWAlertAction(title: "OK" style: .Default) { action in
  7. NSLog("OK action occured.")
  8. }
  9. // Add the action.
  10. alertController.addAction(cancelAction)
  11. alertController.addAction(okAction)
  12. // Show alert
  13. presentViewController(alertController, animated: true, completion: nil)

Customize

  • add TextField (Alert style only)
  • change Fonts
  • change color (Overlay, View, Text, Buttons)

Custom
Limit-Entry-Range

Add TextField

  1. alertController.addTextFieldWithConfigurationHandler { textField in
  2. // text field(UITextField) setting
  3. // ex) textField.placeholder = "Password"
  4. // textField.secureTextEntry = true
  5. }
  6. alertController.textLimit = 20 // you can limit str length for Chinese or English character, base for English character range

Change Design

Overlay color
  1. alertController.overlayColor = UIColor(red:235/255, green:245/255, blue:255/255, alpha:0.7)
Background color
  1. alertController.alertViewBgColor = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
Title (font, text color)
  1. alertController.titleFont = UIFont(name: "GillSans-Bold", size: 18.0)
  2. alertController.titleTextColor = UIColor(red:241/255, green:196/255, blue:15/255, alpha:1)
Message (font, text color)
  1. alertController.messageFont = UIFont(name: "GillSans-Italic", size: 15.0)
  2. alertController.messageTextColor = UIColor.whiteColor()
Button (font, text color, background color(default/highlighted))
  1. alertController.buttonFont[.Default] = UIFont(name: "GillSans-Bold", size: 16.0)
  2. alertController.buttonTextColor[.Default] = UIColor(red:44/255, green:62/255, blue:80/255, alpha:1)
  3. alertController.buttonBgColor[.Default] = UIColor(red: 46/255, green:204/255, blue:113/255, alpha:1)
  4. alertController.buttonBgColorHighlighted[.Default] = UIColor(red:64/255, green:212/255, blue:126/255, alpha:1)
  5. // Default style : [.Default]
  6. // Cancel style : [.Default] → [.Cancel]
  7. // Destructive style : [.Default] → [.Destructive]

Installation

ZWAlertController is available through CocoaPods.

To install add the following line to your Podfile:

  1. pod 'ZWAlertController'

License

This software is released under the MIT License, see LICENSE.txt.

Author

Initial-C-William Chang, iwilliamchang@outlook.com

License

ZWAlertController is available under the MIT license. See the LICENSE file for more info.