p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Menlo; color: #ffffff }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Menlo; color: #ffffff; min-height: 28.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Menlo; color: #00afca }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Menlo; color: #4dbf56 }
span.s1 { color: #c2349b }
span.s2 { }
span.s3 { color: #00afca }
span.s4 { color: #ffffff }
span.s5 { color: #93c96a }
span.s6 { color: #e44347 }
span.s7 { font: 24.0px "PingFang SC"; color: #e44347 }
span.s8 { color: #8b84cf }

import UIKit

class ViewController: UIViewController {

var button : UIButton!

var array = NSMutableArray()

override func viewDidLoad() {

super.viewDidLoad()

self.view.backgroundColor = UIColor.white

array = ["风格一","风格二","风格三"]

creatBtn()

}

func creatBtn(){

for i in 0..<3 {

button = UIButton(frame: CGRect(x: 30, y: 50 + i * 60, width: 315, height: 30))

button.backgroundColor = UIColor.gray

button.tag = i

button.setTitle(array[i] as? String, for: .normal)

button.addTarget(self, action: #selector(remind(btn:)), for: .touchUpInside)

self.view.addSubview(button)

}

}

func remind(btn : UIButton){

if btn.tag == 0 {

let action = UIAlertController(title: nil, message: "选择照片", preferredStyle: .actionSheet)

let photo = UIAlertAction(title: "相册", style: .default, handler: { action  in

})

let camera = UIAlertAction(title: "相机", style: .default, handler: { action in

})

let cancel = UIAlertAction(title: "取消", style: .default, handler: { action in

})

action.addAction(photo)

action.addAction(camera)

action.addAction(cancel)

self.present(action, animated: true, completion: nil)

}else if btn.tag == 1{

let action = UIAlertController(title: "提示", message: "验证码错误", preferredStyle: .alert)

let ok = UIAlertAction(title: "确定", style: .default, handler: { action in

})

let cancel = UIAlertAction(title: "取消", style: .default, handler: { action in

})

action.addAction(ok)

action.addAction(cancel)

self.present(action, animated: true, completion: nil)

}else {

print("我是第三种风格")

}

}

override func didReceiveMemoryWarning() {

super.didReceiveMemoryWarning()

// Dispose of any resources that can be recreated.

}

}

Swift_提醒框的更多相关文章

  1. iOS自学-监听按钮点击、提醒框

    //事件监听的问题 CGRect btn2Frame = CGRectMake(100.0, 150.0, 60.0, 44.0); //两种不同的方式创建 UIButton *btn2 = [UIB ...

  2. RovingUI组件库-包含堆栈式通知提醒框(Toast)的小程序组件库

    RovingUI是个人在开发小程序过程中将用到的组件集合而成的一个UI库,包含一些基本通用组件(按钮.栅格.通用样式.徽标.通知和面包屑). 源起得归于我在开发中没有找到现成的堆栈式提醒框(比如ant ...

  3. 常用UI模板,loading框,提醒框,弹框确认框

    css部分 #public_box{width:100%;height:100%;position:fixed;top:0;left:0;z-index:100;background:rgba(0,0 ...

  4. 巧妙使用 CSS3 的褪色和动画效果制作消息提醒框

    现代Web设计技术允许开发者快速实现大多数浏览器支持的动画.我想警告消息是很常见的,因为默认的JavaScript警告框的样式往往(与你自己设计的漂亮样式)很不协调很囧.这使开发者步入找出哪种解决方案 ...

  5. 【Demo 0002】Android 提醒框

    本章学习要点:   //==: Alert Dialog void showAlertDialog() { final Builder builder = new AlertDialog.Builde ...

  6. (转)C# Windows服务 弹出消息提醒框

    出处:http://blog.csdn.net/donghui6116773/article/details/53467069 服务(Service)对于大家来说一定不会陌生,它是Windows 操作 ...

  7. MyEclipse启动时 弹出提醒框

    1. MyEclipse has detected that less than 5% of the 31MB of PS Survivor Space (Heap memory) space rem ...

  8. 漂亮提醒框js

    <script type="text/javascript"> var filename = "PICC_V2.1.3.0_新增功能操作手册.doc" ...

  9. RTX发送消息提醒实现以及注意事项

    一.RTX简介 RTX是腾讯公司推出的企业级即时通信平台.该平台定位于降低企业通信费用,增强企业内部沟通能力,改善企业与客户之间的沟通渠道,创造新兴的企业沟通文化,提高企业生产力.RTX平台的主要功能 ...

随机推荐

  1. 了解JavaScript 数组对象及其方法

    数组在我目前学习过的编程语言中都可以见到, 形形色色的方法也数不胜数, 不过功能都一样, 最多也就是方法名稍稍有所不同, 老外也没个准啊, 如果英语比较好的同学对于学习方法(method)来说是很快的 ...

  2. Android入门(一)

    原文链接:http://www.orlion.ga/387/ 一.安卓的系统架构 1. linux内核层,这一层为安卓设备提供底层的驱动 系统运行库层,这一层通过一些C/C++库来为Android系统 ...

  3. C# 获取相对路径的字符串

    目录结构 father |—— subfolder1 |—— subfolder2 当前在 subfolder1, 通过相对路径的方式获取 subfolder2的路径 string path = Pa ...

  4. 使用vscode访问和修改远程计算机文件

    使用vscode访问和修改远程文件,分三步实现:在远程linux机器上安装rmate:在本地windows上安装openssh:在vscode中安装扩展remote vscode. 1. 在远程lin ...

  5. Mysql Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

    MySQL字符串比较bug: select * from table_a a left join table_b b on a.field_a = b.field_b   error: Illegal ...

  6. jmeter之连接mysql和SQL Server配置

    下载jdbc驱动 在使用jmeter做性能或自动化测试的时候,往往需要直接对数据库施加压力,或者某些参数只能从数据库获取,这时候就必须使用jmeter连接数据库. 1.下载对应的驱动包 mysql驱动 ...

  7. ubuntu 安装 vmware 12

    安装VMware Workstation 12 ubuntu15.10安装VMware Workstation12的步骤如下: 1.在 https://download3.vmware.com/sof ...

  8. httpClient实现微信公众号消息群发

    1.实现功能 向关注了微信公众号的微信用户群发消息.(可以是所有的用户,也可以是提供了微信openid的微信用户集合) 2.基本步骤 前提: 已经有认证的公众号或者测试公众账号 发送消息步骤: 发送一 ...

  9. ORACLE 利用 REPLACE函数替换字段字符串

    REPLACE(string,s1,s2) string 希望被替换的字符或变量 s1 被替换的字符串 s2 要替换的字符串 SQL> select replace(he love you,he ...

  10. CODE[VS]1372DNA

    Description 为了进一步分析外星生物,专家们决定对 DNA 进行切割.限制性核酸内切酶是基因工程中的重要的工具酶.它会识别一段碱基序列(说白了就是只包含 ATGC 的序列)并且切割开.Eco ...