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 介绍 ...
随机推荐
- TortoiseSVN比较工具设置为BeyondCompare 4
打开TortoiseSVN的Setting,选择左边的Diff Viewer 设置如下: "D:\Program Files\Beyond Compare 4\BComp.exe" ...
- [C++ Primer] 第9章: 顺序容器
顺序容器概述 顺序容器的类型有: 类型 说明 vector 可变长度数组. 支持快速随机访问. deque 双端队列. 支持快速随机访问. list 双向链表. 只支持双向顺序访问. forward_ ...
- XiaoMi Interview Log
面试题目 PHP 弱类型 实现? COW 写时复制 实现? COW的时候内存的变化 12 $a = $b = 1;$b = 2; 的内存变化 ? 提供一个rand()函数[函数输出0 - 正无穷] 想 ...
- TS流解析 二 *****
1.TS格式介绍 TS:全称为MPEG2-TS.TS即"Transport Stream"的缩写.它是分包发送的,每一个包长为188字节(还有192和204个字节的包).包的结构为 ...
- CentOS下查看最后登录的用户信息以及LOG记录
CentOS下查看最后登录的用户信息tail /var/log/messagestail /var/log/secure 我们知道,在redhat下可以用lastlog查看各用户最后登录的信息,用la ...
- Lifecycle of an ASP.NET Web API Message
ASP.NET Web API, as we know now, is a framework that helps build Services over HTTP. Web API was int ...
- 给iOS开发新手送点福利,简述UIControl事件的用法
UIControl事件 1.UIControlEventTouchDown 单点触摸按下事件:用户点触屏幕,或者又有新手指落下的时候. 2.UIControlEventTouchDownRepeat ...
- 精《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #7 Cgroup、Namespace、Linux容器
HACK #7 Cgroup.Namespace.Linux容器 本节将介绍Cgroup与Namespace以及通过这两个功能实现的容器功能.CgroupCgroup(control group)是将 ...
- tensorflow-base_operations
# -*- coding: utf-8 -*-import tensorflow as tf# 基本的常量操作,通过构造函数返回值 定义值的操作operationsa = tf.constant(2) ...
- probably another instance of uWSGI is running on the same address
probably another instance of uWSGI is running on the same address 可以用命令杀掉这个端口在重启: /tcp