SimpleAlertiOS 警告视图
SimpleAlert 是可定制的简单警告和简单的 ActionSheet,使用 Swift 编写。
用法
例
查看简单的警报
let alert = AlertController(title: "title", message: "message", style: .alert) alert.addTextField() alert.addAction(AlertAction(title: "Cancel", style: .cancel)) alert.addAction(AlertAction(title: "OK", style: .ok)) present(alert, animated: true, completion: nil)
自定义默认内容
let alert = AlertController(title: "title", message: "message", style: .alert) alert.addTextField { textField in textField.frame.size.height = 33 textField.backgroundColor = nil textField.layer.borderColor = nil textField.layer.borderWidth = 0 } alert.configureContentView { view in view.titleLabel.textColor = UIColor.lightGrayColor() view.titleLabel.font = UIFont.boldSystemFontOfSize(30) view.messageLabel.textColor = UIColor.lightGrayColor() view.messageLabel.font = UIFont.boldSystemFontOfSize(16) view.textBackgroundView.layer.cornerRadius = 3.0 view.textBackgroundView.clipsToBounds = true } alert.addAction(AlertAction(title: "Cancel", style: .cancel)) alert.addAction(AlertAction(title: "OK", style: .ok)) present(alert, animated: true, completion: nil)
评论