测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可协议 | MIT |
Released上次发布 | 2016年1月 |
SPM支持 SPM | ✗ |
由 Yabuzaki 维护。
YBAlertController 是一个 Swift 库,提供整洁的操作表和警报
let alertController = YBAlertController(title: "Menu", message: "Message", style: .ActionSheet)
// let alertController = YBAlertController(style: .ActionSheet)
// add a button
alertController.addButton(UIImage(named: "comment"), title: "Comment", target: self, selector: Selector("tap"))
// add a button with closure
alertController.addButton(UIImage(named: "tweet"), title: "Tweet", action: {
print("button tapped")
})
// add a button (No image)
alertController.addButton("Open in Safari", target: self, selector: Selector("tap"))
// if you use a cancel Button, set cancelButtonTitle
// alertController.cancelButtonTitle = "Cancel"
// show alert
alertController.show()
func tap() {
print("tap")
}
alertController.buttonIconColor = UIColor.blackColor()
alertController.overlayColor = UIColor(red:235/255, green:245/255, blue:255/255, alpha:0.7)
// if title is nil or empty, the title Label is hidden
alertController.title = "Title"
alertController.titleFont = UIFont(name: "Avenir Next", size: 15)
alertController.titleTextColor = UIColor.blueColor()
// if message is nil or empty, the message Label is hidden
alertController.message = "Message"
alertController.messageFont = UIFont(name: "Avenir Next", size: 15)
alertController.messageTextColor = UIColor.blueColor()
// if cancelButtonTitle is nil or empty, the cancel button is hidden
alertController.cancelButtonTitle = "Cancel"
alertController.cancelButtonFont = UIFont(name: "Avenir Next", size: 15)
alertController.cancelButtonTextColor = UIColor.blueColor()
alertController.buttonFont = UIFont(name: "Avenir Next", size: 15)
alertController.buttonTextColor = UIColor.blueColor()
alertController.touchingOutsideDismiss = true
// default, Alert:false ActionSheet:true
alertController.animated = false
只需将 YBAlertController.swift
拖到您的项目中。
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
Yabuzaki http://twitter.com/planet12app http://appstore.com/yutayabuzaki
YBAlertController 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。