码迷,mamicode.com
首页 > 其他好文 > 详细

SCLButton

时间:2014-10-01 17:41:21      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:style   io   os   ar   sp   c   on   cti   r   

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()

  }

}

 

SCLButton

标签:style   io   os   ar   sp   c   on   cti   r   

原文地址:http://www.cnblogs.com/yushunwu/p/4003329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!