IOS对话框UIAlertView
//修改弹出对话框的样式
alertView.alertViewStyle = UIAlertViewStylePlainTextInput; //根据索引获取指定的某个文本框
[alertView textFieldAtIndex :]
[alertView textFieldAtIndex :].text = her.name; //通过UIAlertView的代理来监听对话框中的按钮的点击事件
//实现UIAlertView的
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 代理方法
实例代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
CZHero *hero = self.heros[indexPath.row];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitels:@"确定",nil];
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[alertView textFieldAtIndex:].text = hero.name;
//记录当前点击行的行号
alertView.tag = indexPath.row;
[alertView show]
}
#pragma mark - alertView的代理方法
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger) buttonIndex{
//判断点击的是哪个按钮
if(buttonIndex ==){
//获取文本框中的数据
NSString *name = [alertView textFieldAtIndex:].text;
//修改模型数据
//根据行号,获取当前点击行的模型数据
CZHero *hero = self.heros[alertView.tag];
hero.name = name;
//重新刷新TableView数据
//重新刷新整个TableView,UITableView会重新向 datasource请求数据
//重新调用数据源方法
//[self.tableView reloadData];//不好重新刷新整个TableView
//局部刷新
//创建一个indexPath对象
NSIndexPath *path = [NSIndexPath indexPathForRow:alertView.tag inSection:];
[self.tableView reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationLeft];
}
}
IOS对话框UIAlertView的更多相关文章
- ios之UIAlertView
举例: UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Default Alert View"messa ...
- android 仿ios 对话框已封装成工具类
对话框 在android中是一种非经常见的交互提示用户的方式,可是非常多产品狗都叫我们这些做android的仿ios,搞的我们android程序猿非常苦逼,凭什么效果老是仿ios,有没有一点情怀,只是 ...
- 【iOS】UIAlertView 点击跳转事件
iOS 开发中,UIAlertView 经常用到.这里记录下曾用到的点击跳转事件. UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@& ...
- iOS之UIAlertView的使用
UIAlertView: 1.普通使用: //普通的alert UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"title&quo ...
- iOS - 提示信息 - UIAlertView、UIActionSheet、UIAlertController的实际应用
1.UIAlertView(屏幕中央弹出框)(不需要服从代理) UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@" ...
- IOS开发:UIAlertView使用
链接地址:http://www.2cto.com/kf/201307/231841.html UIAlertView是什么就不介绍了 1.基本用法 1 UIAlertView *view = [[UI ...
- IOS Using UIAlertView to show alerts
UIAlertView in other words, it's a dialog box. You want to show a message or ask user to confirm an ...
- iOS改变UIAlertView、UIActionSheet、UIAlertController系统字体颜色
废话不多说,直接上代码,效果是最好的说服力 1.改变UIAlertView字体颜色 [UIView appearance].tintColor = [UIColor greenColor]; 个人还是 ...
- IOS中UIAlertView(警告框)常用方法总结
一.初始化方法 - (instancetype)initWithTitle:(NSString *)title message:(NSString*)message delegate:(id /*&l ...
随机推荐
- git使用教程及github远程仓库管理
git使用教程步骤 1.安装git 安装完后,在开始菜单里找到"git"->"Git Bash",蹦出一个类似命令行窗口,说明安装成功.2 注册git 在 ...
- JQ鼠标右键点击功能 兼容IE8
//阻止浏览器当前DIV默认右键事件 $("div").unbind("mousedown").bind("contextmenu", fu ...
- JvisualVM、JMC监控远程服务器
修改服务器上jmxremote.access与jmxremote.password,输入命令: find -name jmxremote.access进入该jmxremote.access文件所在目录 ...
- Pad控件 UIPopoverController的介绍与使用(Pad的专属菜单控件、Swift版本)
UIPopoverController 是iPad特有控件,iOS9之前,在iOS上也可以使用,在iOS9之后,只能用于Pad上. 如果非要在iOS上使用,编译不会有问题,运行后会崩溃,报错如下: T ...
- bcache 状态/配置 文件详细介绍
什么是bcache bcache是linux内核块层cache.它使用类似SSD来作为HDD硬盘的cache,从而起到加速作用. HDD硬盘便宜并且空间更大,SSD速度快但更贵.如果能两者兼得,岂不快 ...
- 持续集成:TestNG组织如何测试用例
持续集成:TestNG组织如何测试用例 poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:90 ...
- poptest老李谈Socket
poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询qq:908821478,咨询电话010-845052 ...
- AngularJS1.X学习笔记2-数据绑定
上一篇从整体上认识了Angular,从现在开始更加深入的学习Angular的特性.本次学习的是数据绑定.应该所有的MVC框架都会用到数据绑定,比如我所知道的ThinkPHP.struts等,只有实现了 ...
- How To Use ggplot in ggplot2?
1.What is ggplot2 ggplot2基本要素 数据(Data)和映射(Mapping) 几何对象(Geometric) 标尺(Scale) 统计变换(Statistics) 坐标系统(C ...
- Entity Framework快速入门--IQueryable与IEnumberable的区别
IEnumerable接口 公开枚举器,该枚举器支持在指定类型的集合上进行简单迭代.也就是说:实现了此接口的object,就可以直接使用foreach遍历此object: IQueryable 接口 ...