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()
}
}
SCLButton的更多相关文章
随机推荐
- ruby 安装 运行
Ruby基础 一 简介 1.Ruby在windows平台下的安装 (1)下载地址:http://rubyinstaller.org/downloads/ (2)安装过程 这里我们选择安装路径为 D:\ ...
- c语言:蜗牛的爬行。
main() { printf("hello,word!,第一次的c语言输出"); }
- Dijkstra算法为什么权值不能为负
Dijkstra算法当中将节点分为已求得最短路径的集合(记为S)和未确定最短路径的个集合(记为U),归入S集合的节点的最短路径及其长度不再变更,如果边上的权值允许为负值,那么有可能出现当与S内某点(记 ...
- JVM 调优
JVM内存,由三个部分构成 年轻代+老年代+永久代: 需要调试的是年轻代和老年代 的参数: 先解释几个JVM参数: -XMx : 最大可用内存: -Xms:初始化内存: -xss: 线程栈 的大小: ...
- [Angular 2] ng-model and ng-for with Select and Option elements
You can use Select and Option elements in combination with ng-for and ng-model to create mini-forms ...
- 监控 Linux 性能的 18 个命令行工具
http://www.oschina.net/translate/command-line-tools-to-monitor-linux-performance 1.Top-Linux进程监控 Lin ...
- STL——前闭后开区间表示法和function call 操作符
前开后闭开区间表示法[) 任何一个STL算法,都需要获得由一对迭代器(泛型指针)所标示的区间,用以表示操作范围,这一对迭代器所标示的是个所谓的前闭后开区间,以[first,last)表示,也就是说,整 ...
- ActiveNotifications
The NotificationManager can tell you how many notifications your application is currently showing. T ...
- 进阶篇,第二章:MC与Forge的Event系统
<基于1.8 Forge的Minecraft mod制作经验分享> 这一章其实才应该是第一章,矿物生成里面用到了Event的一些内容.如果你对之前矿物生成那一章的将算法插入ORE_GEN_ ...
- datazen 备份还原
DataZen备份: DataZen还原 第一步:用管理员进入dos,输入 net stop datazen 第二步:切换到datazen Core Service的安装目录cd c:\Progr ...