AnyAlert 4.0.2

AnyAlert 4.0.2

Chris Allinson维护。



AnyAlert 4.0.2

  • 作者
  • ChrisAllinson

AnyAlert

v3.1.0

为Swift定制的Alert消息

特性

  • 可定制一切
  • 支持iPhoneX

要求

  • Xcode 9.0+
  • iOS 9.0+
  • Swift 4.0+或Objective-C

安装

CocoaPods

CocoaPods

pod 'AnyAlert', '3.1.0'

Carthage

Carthage

... 即将推出 ...

Swift 包管理器

Swift 包管理器

... 即将推出 ...

手动

将以下6个文件导入您的项目: AnyAlert-iOS @ GitHub


使用方法

编辑 info.plist 文件

基于视图控制器的状态栏外观 = 否

导入 AnyAlert

import AnyAlert

显示一个警告信息

简单创建一个AnyAlert对象,然后调用AnyAlertManager.show(_ alert: AnyAlert, from vc: UIViewController)

let tempAlert: AnyAlert = AnyAlert(
    message: "Test Message",
    backgroundColor: .red,
    statusBarStyle: .lightContent,
    messageFont: UIFont.systemFont(ofSize: 16.0),
    messageColor: .white,
    closeButtonFont: UIFont.systemFont(ofSize: 16.0),
    closeButtonColor: .white,
    height: 95.0,
    openSpeed: 0.5,
    closeSpeed: 0.5,
    doesSelfDismiss: false,
    showFor: 2.0
)

AnyAlertManager.show(tempAlert, from: self)

带有点击处理器的显示警告信息

简单创建一个AnyAlert对象,然后调用AnyAlertManager.show(_ alert: AnyAlert, from vc: UIViewController, tapHandler: @escaping (() -> Void))

let tempAlert: AnyAlert = AnyAlert(
    message: "Test Message",
    backgroundColor: .red,
    statusBarStyle: .lightContent,
    messageFont: UIFont.systemFont(ofSize: 16.0),
    messageColor: .white,
    closeButtonFont: UIFont.systemFont(ofSize: 16.0),
    closeButtonColor: .white,
    height: 95.0,
    openSpeed: 0.5,
    closeSpeed: 0.5,
    doesSelfDismiss: false,
    showFor: 2.0
)

AnyAlertManager.show(tempAlert, from: self, tapHandler: {
    print("Tapped!")
})

源代码

GitHub

致谢

AnyAlert由Chris Allinson拥有并维护。

许可

AnyAlert遵循MIT许可。详情请见LICENSE文件。