IOS UIAlertView
2015-11-15 17:56
387 查看
// // ViewController.swift // UIAlertView // // Created by liaojianguo on 15/11/15. // Copyright © 2015年 liaojianguo. All rights reserved. // import UIKit class ViewController: UIViewController { func alertView(alertView : UIAlertView,clickedButtonAtIndex buttonIndex:Int) { if(buttonIndex==alertView.cancelButtonIndex) { print("点击了取消") }else { let name = alertView.textFieldAtIndex(0) let password = alertView.textFieldAtIndex(1) print("用户名是:\(name!.text) 密码是:\(password!.text)") } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let alertView = UIAlertView() alertView.message="你确认删除这篇文章吗?" alertView.title="系统提示" alertView.addButtonWithTitle("取消") alertView.addButtonWithTitle("确认") alertView.cancelButtonIndex=0 alertView.delegate=self//对应UIAlertViewDelegate看一看其所有的方法 //告警框有下面4种样式 //Default:默认样式 //PlainTextInput:带输入框的告警框 //SecureTextInput:带密码框的告警框 //LoginAndPasswordInput:带输入框和密码框的告警框 alertView.alertViewStyle = UIAlertViewStyle.LoginAndPasswordInput //alertView.alertViewStyle = UIAlertViewStyle.PlainTextInput alertView.show() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
相关文章推荐
- 05 ueditor上传图片配置
- 【LigerUI实战】Grid弹出编辑popup
- [转]UIModalPresentationStyle和UIModalTransitionStyle
- FetchRequestController
- Android Stduio的使用(七)--Structure窗口
- IOS UISlider
- GPUImage API文档之GPUImageInput协议
- UIButton
- 开源,部落冲突辅助,C#4.6,win10,bluestacks最新。
- iOS引用当前显示的UIAlertView
- <%=request.getContextPath()%>的作用
- iOS之UI初级---UIWindow的基本内容
- UIView
- UI框架
- Java中AWT,Swing与SWT三大GUI技术的原理与效率区别
- Fruit Ninja(树状数组+思维)
- C#实现SQLSERVER数据库中有序GUID生成(NewSequentialId)
- 用soapUI测试webservice
- UILabel标签
- UI之区头表头区尾表尾快速定位A—Z