ATZAlertController 1.2.1

ATZAlertController 1.2.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2016年7月
SPM支持 SPM

Shashank Pali 维护。



  • Shashank Pali

ATZAlertController

ATZAlertController 帮助您从任何类中创建警报,而不依赖于 ViewController。这个名字本身就意味着它提供了从 A 到 Z 的解决方案,针对 UIAlertController 提供了各种类型的函数,您可以根据需要进行使用。ATZAlertController 易于使用和实现。

Pod 安装

CocoaPods 是安装此库的首选方式。将此命令添加到您的 Podfile


pod 'ATZAlertController'

对于 Objective-C.

直接安装

下载 .zip 文件并解压缩。在那里您将找到 ATZAlertController 文件夹,将文件夹中的所有文件复制到您的相应项目中。

集成方法


 ATZAlertController.alertWithTitle("My Alert",
                          message: "Array containing object as 'String'",
                cancelButtonTitle: "Cancel",
           destructiveButtonTitle: "Remove",
                otherButtonTitles: ["Ok","Right"],
                   preferredStyle: .Alert,
               showAlertInstantly: true,
                          handler: { (action, titleString) in

                                      if(titleString == "Cancel")
                                      {
                                        print("\(action.title)")
                                      }
                                      if(titleString == "Remove")
                                      {
                                        print("\(action.title)")
                                      }
                                      if(titleString == "Ok")
                                      {
                                        print("\(action.title)")
                                      }
                                      if(titleString == "Right")
                                      {
                                        print("\(action.title)")
                                      }
                                    })
let button1 = ATZActionButton.actionWithTitleAndPrefferedStyle("Ok", style: .Default)
let button2 = ATZActionButton.actionWithTitleAndPrefferedStyle("Remove", style: .Destructive)

alert = ATZAlertController.alertWithTitle("My Alert",
                                  message: "Array containing object ATZActionButton",
                        cancelButtonTitle: "Cancel",
                        otherActionButton: [button1, button2],
                           preferredStyle: .Alert,
                       showAlertInstantly: false,
                                  handler: { (action, titleString) in

                                              if(titleString == "Cancel")
                                              {
                                                print("\(action.title)")
                                              }
                                              if(titleString == "Remove")
                                              {
                                                print("\(action.title)")
                                              }
                                              if(titleString == "Ok")
                                              {
                                                print("\(action.title)")
                                              }
                                            })
alert.showWithAnimation(false)
ATZAlertController.loginAlertWithTitle("Login Alert",
                                message: "All fields are mandatory",
               userNamePlaceholderTitle: "Username",
               passwordPlaceholderTitle: "Password",
                     showAlertInstantly: true,
                                handler: { (action, titleString) in

                                            if(titleString == "Login")
                                            {
                                              print("\(alert.textFields![0].text) \n \(alert.textFields![1].text)")
                                            }
                                            if(titleString == "Cancel")
                                            {
                                              print("\(action.title)")
                                            }
                                          })

感谢

许可证

ATZAlertController 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。