WMAlertController
要求
- iOS 9.0+
- Swift 4.0+
安装
WMAlertController 通过 CocoaPods 可用。安装它,只需将以下行添加到您的 Podfile 中
pod 'WMAlertController'
关于
WMAlertController 是一个完全可定制的 alert controller,其功能类似于熟悉的 UIAlertController。
使用提供的 WMAlertStyle,您可以修改以下属性
- overlayBackgroundColor
- backgroundColor
- cornerRadius
- titleFont
- titleTextColor
- titleNumberOfLines
- messageFont
- messageTextColor
- messageNumberOfLines
- separatorColor
- titleAttributes
- messageAttributes
使用方法
let alertController = WMAlertController(
title: "Confirmation",
message: "Example Alert Controller",
style: .light,
decoration: .none
)
alertController.addAction(WMAlertAction(title: "Cancel", handler: { (action) in
action.alert?.dismiss(animated: true, completion: nil)
}))
alertController.addAction(WMAlertAction(title: "Do the action", handler: { (action) in
action.alert?.dismiss(animated: true, completion: {
// Do some work...
})
}))
self.present(alertController, animated: true, completion: nil)
许可
WMAlertController 在 ASLv2 许可下提供。有关更多信息,请参阅 LICENSE 文件。