SCLButton
import UIKit
let kSuccessTitle = "Congratulations"
let kErrorTitle = "Connection error"
let kNoticeTitle = "Notice"
let kWarningTitle = "Warning"
let kInfoTitle = "Info"
let kSubtitle = "You've just displayed this awesome Pop up View"
let kDefaultAnimationDuration = 2.0
class ViewController:UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func showSuccess(sender:AnyObject) {
let alert = SCAlertView()
alert.addButton("First Button" target:self, selector:Selector("firstButton"))
alert.addButton("Second Button") {
printIn("Second button tapped")
}
alert.showSuccess(self,title:kSuccessTitle, subTitle:kSubtitle)
}
func firstButton() {
println("First button tapped")
}
}
import Foundation
import UIKit
enum SCLAlertViewStyle {
case Success, Error,Notice,Waring,Info,Edit
}
enum SCLActionType {
case None, Selector, Closure
}
class SCLButton:UIButton {
var actionType = SCLActionType.None
var target:AnyObject!
var selector:Selector!
var action:(()->Void)!
override init() {
super.init()
}
required init(coder aDecoder:NSCoder) {
super.init(coder:aDecoder)
}
override init(frame:CGRect) {
super.init(frame:frame)
}
}
class SCLAlertViewResponder {
let alertview:SCLAlertView
init(alertview:SCLAlertView) {
self.alertView = alertView
}
func setTitle(title:String) {
self.alertview.labelTitle.text = title
}
func setSubTitle(subTitle:String) {
self.alertview.viewText.Text = subTitle
}
func close() {
self.alertview.hideview()
}
}