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. iOS开发--Swift RAC响应式编程初探

    时间不是很充足, 先少说点, RAC的好处是响应式编程, 不需要自己去设置代理委托, target, 而是主要以信息流(signal), block为主, 看到这里激动吧, 它可以帮你监听你的事件, ...

  2. iOS中的一些细节

    1. 在使用单例模式时一般使用allocWithZone 因为alloc最终还是会调用allocWithZone进行分配空间 2. synchronized 线程锁(互斥锁) 优点:能防止多线程抢夺资 ...

  3. 1、开篇:公司管理经验谈 - CEO之公司管理经验谈

    作为一家IT公司的CEO,我很高兴与大家通过博文的方式进行沟通交流.一方面能够将自己的成长之路以博文的方式记录下来,另一方面是能够与大家交朋友,与大家沟通公司管理方面的知识和经验. 首先,笔者在200 ...

  4. 分布式一致性算法--Paxos

    Paxos算法是莱斯利·兰伯特(Leslie Lamport)1990年提出的一种基于消息传递的一致性算法.Paxos算法解决的问题是一个分布式系统如何就某个值(决议)达成一致.在工程实践意义上来说, ...

  5. Oracle 数据库中对记录进行分页处理——学习笔记

    学习到 oracle 的视图的时候,了解到对 Oracle 中数据的记录进行分页处理和 Mysql 提供的 limit 来进行分页处理大有不同,limit 是 mysql 中特有的关键字. 那么在 o ...

  6. 用css改变默认的checkbox样式

    自己常用的改变checkbox样式的两个方法: 一.利用background用图片代替checkbox效果 缺点:你首先得有一张好看的图片 优点:浏览器兼容性好 <!doctype html&g ...

  7. Win10全屏看视频时任务栏不隐藏

    解决办法: 1.对任务栏鼠标右键点击,选择"任务管理器" 2.在进程选项下找到Windows进程中的Windows资源管理器 3.对Windows资源管理器鼠标右键,选择重新启动

  8. 创建docker私人仓库

    关于创建docker私人仓库 1.1.           安装步骤 1.1.1.            直接从公共库上面下载register镜像在本地执行 1.1.1.1.             ...

  9. 收集几个不错的最新win10系统64位和32位系统Ghost版下载

    系统来自转载:系统妈 ◆ 版本特点 该版本安装后可利用微软公开的Windows10 KMS密钥激活,且右小角无版本水印. KMS客户端密钥:NPPR9-FWDCX-D2C8J-H872K-2YT43, ...

  10. [LeetCode] Distinct Subsequences 不同的子序列

    Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence ...