UIAlertView上添加输入框UITextField
来源:互联网 发布:mac刷新桌面 编辑:程序博客网 时间:2024/06/05 20:37
UIAlertView上添加输入框UITextField
1、初始化UIAlertView,并添加UITextField
UIAlertView *exitAlertView=[[UIAlertView alloc]initWithTitle:@"退出原因" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
exitAlertView.alertViewStyle=UIAlertViewStylePlainTextInput;
UITextField *reasonField=[exitAlertView textFieldAtIndex:0];
reasonField.placeholder=@"请输入退出原因";
[exitAlertView show];
2、在UIAlertView的代理方法中为确定按钮添加点击事件(前提记得添加UIAlertViewDelegate)
#pragma mark - UIAlertViewDelegate
//为按钮添加点击事件
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@" button index=%ld is clicked.....", buttonIndex);
UITextField *reasonField = [alertView textFieldAtIndex:0];
//_reasonStr 为全局变量的Nsstring,获取UITextField中的输入值
_reasonStr=reasonField.text;
//buttonIndex为1是确定按钮
if (buttonIndex == 1) {
//调用接口
[self postQuitTravel];
[reasonField resignFirstResponder];
}
else{
[reasonField resignFirstResponder];
}
}
- UIAlertView上添加输入框UITextField
- 给UIAlertView添加UITextField模拟登录框
- UIAlertView视图中添加UITextField
- UIAlertView视图中添加UITextField
- 往UIAlertView中添加UITextField模拟登录框
- 在UIAlertView上面添加输入框
- 在UIAlertView上面添加输入框
- 在UIAlertView上面添加输入框
- 警告框扩展应用:给UIAlertView添加UITextField模拟登录框
- IOS UIAlertView 上添加View
- 带输入框的UIAlertView
- 带输入框的UIAlertView
- 输入框UITextField
- 文本输入框UITextField
- UITextField/文本输入框
- UITextField(输入框)
- 输入框UITextField
- UITextField 输入框
- 详解 ASP.NET异步
- OpenGL ES 2.0 Shader相关介绍
- WEIPHP使用
- C++中实数(以float为例)的存储方式
- C++ 和 Object-c 混编时 提示的 class 错误
- UIAlertView上添加输入框UITextField
- poj2553The Bottom of a Graph【tarjan中SCC出度是1】
- 多平台游戏渲染开发
- grunt学习笔记一:grunt安装
- storyboard设置控件的长宽比和控件之间的尺寸成比例
- Direct3D9 Fx/HLSL的若干条有用的笔记
- POJ 2689 Prime Distance (大素数筛)
- 关于My97DatePicker的使用,简单易用的强大日期控件
- 在Unity 3D中,shader是何时编译的,在何时加载入显存中的?