Skip to content

Harness the UIAlertController with a simplified, chainable and expressive syntax.

License

Notifications You must be signed in to change notification settings

CancerQ/YZAlertController

Repository files navigation

YZAlertController

Harness the UIAlertController with a simplified, chainable and expressive syntax.

Demo Project

See Demo/YZAlertControllerDemo.xcodeproj

Installation

CocoaPods

  1. Add pod 'YZAlertController' to your Podfile.
  2. Run pod install or pod update.
  3. Import <YZAlertController/YZAlertController.h>.

Manually

  1. Download all the files in the YZAlertController subdirectory.
  2. Add the source files to your Xcode project.
  3. Link with required frameworks:
    • UIKit
    • CoreFoundation

Requirements

This library requires iOS 8.0+ and Xcode 9.0.

Usage

Heres the same UIAlertController created using YZAlertController

    [[[[[[YZAlertController.title(@"title").message(@"message").preferredStyle(UIAlertControllerStyleAlert)
          addAction:nil](@"Action1", UIAlertActionStyleDestructive)
         addAction:nil](@"Action2", UIAlertActionStyleDefault)
        addAction:^(UIAlertAction *action) {
            NSLog(@"action title is:%@",action.title);
        }](@"Action", UIAlertActionStyleCancel)
       addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }]addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }]addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }].showOnCtr(ctr);

License

YZAlertController is provided under the MIT license. See LICENSE file for details.

中文介绍

YZAlertController 是将UIAlertController使用简化的、可链接的和表达性的语法来封装利用。

演示项目

查看并运行 Demo/YZAlertControllerDemo.xcodeproj

安装

CocoaPods

  1. 在 Podfile 中添加 pod 'YZAlertController'
  2. 执行 pod installpod update
  3. 导入 <YZAlertController/YZAlertController.h>。

手动安装

  1. 下载 YZAlertController 文件夹内的所有内容。
  2. 将 YZAlertController 内的源文件添加(拖放)到你的工程。
  3. 链接以下 frameworks:
    • UIKit
    • CoreFoundation

系统要求

该项目最低支持 iOS 8.0Xcode 9.0

用法

使用YZAlertController创建一个相同的UIAlerController

    [[[[[[YZAlertController.title(@"title").message(@"message").preferredStyle(UIAlertControllerStyleAlert)
          addAction:nil](@"Action1", UIAlertActionStyleDestructive)
         addAction:nil](@"Action2", UIAlertActionStyleDefault)
        addAction:^(UIAlertAction *action) {
            NSLog(@"action title is:%@",action.title);
        }](@"Action", UIAlertActionStyleCancel)
       addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }]addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }]addTextFieldWithConfigurationHandler:^(UITextField *textField) {
           textField.placeholder = @"textField";
       }].showOnCtr(ctr);

许可证

YZAlertController 使用 MIT 许可证,详情见 LICENSE 文件。

About

Harness the UIAlertController with a simplified, chainable and expressive syntax.

Resources

License

Stars

Watchers

Forks

Packages

No packages published