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 介绍 ...
随机推荐
- 黑马程序员【JSP九大内置对象和四个作用域】转载
http://www.cnblogs.com/fanfu1/p/4530980.html JSP九大内置对象和四个作用域 ------- android培训.java培训.期待与您交流! ------ ...
- Java与SQL Server, MySql, Oracle, Access的连接方法以及一些异常解决
Java与SQL Server, MySql, Oracle, Access的连接方法以及一些异常解决 I. 概述 1.1 JDBC概念 JDBC(Java Database Connectivity ...
- .NET 4.5 HttpClient 中使用Cookie
为了使用.NET 4.5的HttpClient从WIN2K3换成了WIN7.装VS2010,结果告诉我VS2010不支持.NET 4.5.又装VS2012,接着装.NET FRAMEWORK 4.5. ...
- mediawiki 安装 部署 配置 使用学习
学习资源: https://blog.csdn.net/gao36951/article/details/43965527 http://blog.csdn.net/hualichenxi123/ar ...
- ajax readyState=4并且status=200时,还进error方法
今天在使用jQuery.ajax方法去调用后台方法时,ajax中得参数data类型是"JSON",后台DEBUG调试,运行正常, 返回正常的结果集,但是前端一直都进到ajax的er ...
- week3-栈和队列
1.学习总结 2.PTA实验作业 2.1 题目1:7-1 jmu-报数游戏 2.2 设计思路(伪代码或流程图) 2.3 代码截图 2.4 PTA提交列表说明. 答案错误:error少了 !: 非零返回 ...
- 第八章(三)基于Listcheck适配器的访问控
denier适配器访问控制比较死板.Listchecker的适配器更加灵活. 定义handler: apiVersion: config.istio.io/v1alpha2 kind: listche ...
- C++中如何强制inline函数(MSVC, GCC)
#ifdef _MSC_VER_ // for MSVC #define forceinline __forceinline #elif defined __GNUC__ // for gcc on ...
- uva-10785-模拟水题
模拟题: 1• The name has a predefined length N.名字长度N2• The vowel value and consonant value of the name m ...
- 学习记录:CONCAT()
连接多个字符串 SELECT * from t_info where phone = CONCAT('12345','678900')