在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
SCLAlertView-Swift https://github.com/vikmeup/SCLAlertView-Swift
Animated Alert View written in Swift, which can be used as a 用swift写的一个可以做动画的AlertView,你可以用它替换 UIAlertView 或者是 UIAlertController。苹果官方在 iOS 8.x 的时候开始弃用 UIAlertView ,如果你使用 Swift 开发项目,且想支持 iOS 7.x,SCLAlertView 可以满足你的需求。
Easy to use // Get started
SCLAlertView().showInfo("Important info", subTitle: "You are great")
let alertViewResponder: SCLAlertViewResponder = SCLAlertView().showSuccess("Hello World", subTitle: "This is a more descriptive text.")
// Upon displaying, change/close view
alertViewResponder.setTitle("New Title") // Rename title
alertViewResponder.setSubTitle("New description") // Rename subtitle
alertViewResponder.close() // Close view
SCLAlertView().showTitle(
title: "Congratulations", // Title of view
subTitle: "Operation successfully completed.", // String of view
duration: 2.0, // Duration to show before closing automatically, default: 0.0
completeText: "Done", // Optional button value, default: ""
style: .Success // Styles - see below.
colorStyle: 0xA429FF,
colorTextButton: 0xFFFFFF
)
let alertView = SCLAlertView()
alertView.addButton("First Button", target:self, selector:Selector("firstButton"))
alertView.addButton("Second Button") {
println("Second button tapped")
}
alertView.showSuccess("Button View", subTitle: "This alert view has buttons")
let alertView = SCLAlertView()
alertView.showCloseButton = false
alertView.showSuccess("No button", subTitle: "You will have hard times trying to close me")
// Add a text field
let alert = SCLAlertView()
let txt = alert.addTextField(title:"Enter your name")
alert.addButton("Show Name") {
println("Text value: \(txt.text)")
}
alert.showEdit("Edit View", subTitle: "This alert view shows a text box")
enum SCLAlertViewStyle: Int {
case Success, Error, Notice, Warning, Info, Edit, Wait
}
安装 SCLAlertView is available through CocoaPods. 你可以通过 CocoaPods 安装 SCLAlertView。 To install add the following line to your Podfile: 添加下面一句话即可:
I tried to build an easy to use API, while beeing flexible enough for multiple variations, but I'm sure there are ways of improving and adding more features, so feel free to collaborate with ideas, issues and/or pull requests.
Has been developed initially for the Scroll Feed app
|
请发表评论