swift学习之-- UIAlertViewController -alert
// ViewController.swift
// alertView
//
// Created by su on 15/12/7.
// Copyright © 2015年 tian. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var controller:UIAlertController!
override func viewDidLoad() {
// 1.强制对Optional值进行拆包(unwrap)
// 2.声明Implicitly Unwrapped Optionals值,一般用于类中的属性
super.viewDidLoad()
//创建UIAlertController实例
controller = UIAlertController(title: "我是**", message: "爱我的点击确定", preferredStyle: UIAlertControllerStyle.Alert)
controller.addTextFieldWithConfigurationHandler { (textFiled:UITextField!) -> Void in
textFiled.placeholder = "我们都爱Swift"
}
//创建action
// let action = UIAlertAction(title: "确定", style: UIAlertActionStyle.Default) { (paramAction:UIAlertAction!) -> Void in
// print("果然是真爱啊")
// }
let action = UIAlertAction(title: "确定", style: UIAlertActionStyle.Default) { (paramActoin:UIAlertAction!) -> Void in
if let textFields = self.controller.textFields {
let txtFields = textFields as [UITextField]
let txt = txtFields[0].text
print("输入的内容是:\(txt)")
}
}
//让alertController添加action
controller.addAction(action)
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.presentViewController(controller, animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
swift学习之-- UIAlertViewController -alert的更多相关文章
- swift 学习之 UIAlertViewController
// // PushViewController.swift // tab // // Created by su on 15/12/7. // Copyright © 2015年 tian. ...
- swift学习之-- UIAlertVIewController - uiactionsheet
// // ViewController.swift // actionsheet // // Created by su on 15/12/7. // Copyright © 2015年 t ...
- Swift学习之常用UI的使用
Swift学习之常用UI的使用 最近笔者在开始学习苹果最新的编程语言,因为笔者认为,苹果既然出了这门语言就绝对不会放弃,除非苹果倒闭了(当然这里知识一个玩笑). 所以在不久的将来,swift绝对是iO ...
- swift学习:第一个swift程序
原文:swift学习:第一个swift程序 最近swift有点火,赶紧跟上学习.于是,个人第一个swift程序诞生了... 新建项目
- 【swift学习笔记】二.页面转跳数据回传
上一篇我们介绍了页面转跳:[swift学习笔记]一.页面转跳的条件判断和传值 这一篇说一下如何把数据回传回父页面,如下图所示,这个例子很简单,只是把传过去的数据加上了"回传"两个字 ...
- 今天开始Swift学习
今天开始Swift学习 在此记录笔记 以备之后查阅! allenhuang
- iOS ---Swift学习与复习
swift中文网 http://www.swiftv.cn http://swifter.tips/ http://objccn.io/ http://www.swiftmi.com/code4swi ...
- 12套swift学习资源分享
虽然objective-c编程语言在过去很长一段时间都是iOS应用开发的基础语言,且很多iOS开发者对其也深爱有佳,但是随着swift编程语言的问世,迅速发展为开发者追捧的语言.且今年伴随着swift ...
- [转]swift 学习资源 大集合
今天看到了一个swift的学习网站,里面收集了很多学习资源 [转自http://blog.csdn.net/sqc3375177/article/details/29206779] Swift 介绍 ...
随机推荐
- Mybatis 插件实现动态设置参数
原文地址:Mybatis 插件实现动态设置参数 博客地址:http://www.extlight.com 一.背景 笔者在搭建架构时,通常会利用泛型对 dao 层 和 service 层公共的代码(增 ...
- phalcon安装笔记
参考官网 git clone --depth= git://github.com/phalcon/cphalcon.git cd cphalcon/build sudo ./install 添加配置文 ...
- emacs之配置symbol浏览界面
由于ecb的method-buffer不能更新,因此抛弃ecb,speedbar的method也不能更新,换imenu-tree 使用el-get install安装imenu-tree imenu- ...
- canvas变换
canvas变换 方法 save() 保存canvas状态 restore() 回复canvas保存的状态 translate(x, y) 移动canvas位置 rotate(radians) 顺时针 ...
- Pthreads 环境配置,VisualStudio
▶ Visual Studio 下配置MPI环境 ● 下载 Pthreads(http://pthreads.org/),解压. ● 针对 x64 程序的配置 ■ 将 Pre-built.2\incl ...
- spring data jpa 的各种查询总结
参考哦:https://blog.csdn.net/weixin_36667844/article/details/79945156
- Spring IO Platform介绍
为什么要用Spring IO Platform 今天无意间看到了一个关键词:"Spring IO Platform",第一直觉是不是有关于IO方面的框架或者包呢,查了一下,居然是为 ...
- Java Graphics 2D绘制图片 在Liunx上乱码
绘图的代码工具类 package com.gwzx.framework.captcha; import java.awt.Color; import java.awt.Font; import jav ...
- warning LNK4099: PDB 'vc100.pdb' was not found... 解决方案
使用VS2010在编译得代码工程的时候,原本在debug下是没有问题,但是在release下编译始终会报: “warning LNK4099: PDB 'vc100.pdb' was not foun ...
- tomcat安装出现问题及解决方法
1. tomcat安装: 安装目录-->D:\Program Files\apache-tomcat-7.0.59 2. tomcat环境变量配置: 3. D:\Program Files\ap ...