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的更多相关文章
随机推荐
- 在线程中进行读取并写入文件和wenjia
新人求(胸)罩!!! import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException ...
- 实现O(1)时间复杂度带有min和max 函数的栈
仅仅是演示实现.不考虑栈使用的数据结构是vector 还是其它容器. 代码例如以下 #include <iostream> #include <vector> using na ...
- PermGen space错误解决方法
在看下文之前,首先要确认意见事情,就是你是怎样启动tomcat的,我们在平时的开发环境其中,都是通过startup.bat方式启动tomcat的,那么你依照以下的方式,去改动/bin/catalina ...
- [译]C++如何切分字符串
声明: 翻译仅以技术学习和交流为目的,如需转载请务必标明原帖链接. http://stackoverflow.com/questions/236129/how-to-split-a-string-in ...
- Android实现网络多线程断点续传下载(转)
本示例介绍在Android平台下通过HTTP协议实现断点续传下载. 我们编写的是Andorid的HTTP协议多线程断点下载应用程序.直接使用单线程下载HTTP文件对我们来说是一件非常简单的事.那么,多 ...
- 使用CSS、JS的几种方法
引用CSS到html网页里的4种方法 1.行内式 在标记的style属性中设定CSS样式,这种方式本质上没有体现出CSS的优势,因此不推荐使用 <div style="widt ...
- C#解leetcode 219. Contains Duplicate II
该题用到了.NET 3.5在System.Collections.Generic命名空间中包含一个新的集合类:HashSet<T>的Add()方法,详细信息请看转载:C# HashSet ...
- OD: Vulnerabilities Analyze Skills
第五篇了,漏洞分析案例 漏洞利用的灵活程度让这门技术变得似乎没有什么原则可言,只有实践后总结提高才能挥洒自如. 漏洞分析方法 目标:弄清攻击原理.评估潜在利用方式及风险等级.扎实的漏洞利用技术是进行漏 ...
- MySQL+PHP配置 Windows系统IIS版(转)
1.下载 MySQL下载地址:http://dev.mysql.com/downloads/mysql/5.1.html->Windows (x86, 32-bit), MSI Installe ...
- MiniProfiler.EF6监控调试MVC5和EF6的性能
转自:蓝狐学MVC教程 以前开发Webform的时候可以开启trace来跟踪页面事件,这对于诊断程序的性能是有很大的帮助的,起到事半功倍的作用,今天我就来谈用mvc开 发项目的调试和性能监控.EF框架 ...