ios UIAlertView
2015-09-06 18:07
417 查看
ios UIAlertView相关代码如下:
- (IBAction)clicked:(id)sender { UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"请输入球队名称" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; [alertView setAlertViewStyle:UIAlertViewStylePlainTextInput]; [alertView show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex==1) { //得到用户输入的内容 NSString *teamName = [alertView textFieldAtIndex:0].text; if (alertView.tag==0) {//添加 //创建Team对象 Team *t = [NSEntityDescription insertNewObjectForEntityForName:@"Team" inManagedObjectContext:self.app.managedObjectContext]; t.name = teamName; }else{//编辑 self.editTeam.name = teamName; } [self.app saveContext]; //让tableView刷新显示 [self.tableView reloadData]; } }
相关文章推荐
- Android更新ui 的几种方式?Handler 机制(二)
- iOS9新特性 - UIStack View
- UI基础-01 隐藏键盘
- DuiLib : 执行按钮事件, 模拟按钮的点击
- UE4的编译配置详解
- Failed to run the WC DB work queue associated with 错误的解决
- ZOJ 3210 A Stack or A Queue?
- Arduino 红外接收
- Qt Quick中的信号机制
- IOS获取设备的UUID
- 父视图 使用 UIViewAnimationWithBlocks 时,如何让子视图无动画
- std::priority_queue
- HDU1047 - Integer Inquiry (大数加法)
- IOS 键盘的显示与关闭,以及移动显示(UITextView处理完整版)
- shop++ CriteriaQuery 数据库查询语句
- UIScrollView上截图
- UIView截图
- serialVersionUID的作用
- codeforces 487 C Prefix Product Sequence 构造+逆元
- UIScrollView相关