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的更多相关文章

随机推荐

  1. Demon_背包系统(实现装备栏,背包栏,可以切换装备)

    using UnityEngine; using System.Collections; public enum BoxType { Normal,//普通格子 Equip//装备栏格子 } publ ...

  2. angular2的管道初体验

    ng管道是应用里面比较重要的一个技术,他涉及很多功能 包括排序过滤 废话不说 直接上代码 新建个文件夹吧这个samplepipe.ts放进去 然后 你要做什么 在里面写管道代码 然后在app.modu ...

  3. Go语言学习笔记(一) : 搭建Windows下的Go开发环境

    最近突然对Go语言产生了兴趣,主要是因为在使用python的时候遇到了一些不爽的问题,然后发现了Go.Go是Google出的一个动态语言,语法和C++接近,性能也非常的好,而且还支持编译成exe发布, ...

  4. PHP CodeBase: 判断用户是否手机访问(转)

    随着移动设备的普及,网站也会迎来越来越多移动设备的访问.用适应PC的页面,很多时候对手机用户不友好,那么有些时候,我们需要判断用户是否用手机访问,如果是手机的话,就跳转到指定的手机友好页面.这里就介绍 ...

  5. digoal -阿里云postgrel大神

    https://yq.aliyun.com/users/1384833841157402?spm=5176.100239.blogrightarea51131.3.T5LRsF

  6. RJ45口线序的理解

    RJ45线序就是TX_P / TX_N / RX_P / RX_N 四根线,分别用到的是1,2,3,6 因为TX要匹配RX,所以 线1 变成 另一端的 线3, 线2 变成 另一端的 线6 反过来也一样

  7. Shell 获取当前时间

    #! /bin/bash time=`date '+%Y-%m-%d %H:%M:%S'` # echo $time sql='SELECT `username`, `password` FROM ` ...

  8. Mac上安装pexpect

    1.首先安装pip sudo easy_install pip 2.pip安装pexpect sudo pip install pexpect

  9. Day2 - Python基础2 列表、字典、集合

    Python之路,Day2 - Python基础2   本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1. 列表.元组操作 列表是我们最以后最常用的数据类型之一, ...

  10. 生成PDF并下载。

    例子是生成一个pdf格式的证书: //创建Document Document document = null; //为该Document创建一个Writer实例 PdfWriter writer = ...