iOS开发学习之#提醒处理#(1)响应提醒视图
来源:互联网 发布:尤克里里推荐知乎 编辑:程序博客网 时间:2024/06/03 19:11
在这里我用到了视图库里的Navigation Controller导航控制器。
提醒操作主要用到了UIAlertviewDelegate协议中的alertView:clickButtonAtIndex:方法实现,其语法形式如下:
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
(UIAlertView *)alertView用来指定警告视图中包含的按钮,(NSInteger)buttonIndex用来指定点击的按钮的索引
核心代码如下:
TableViewController.h
#import <UIKit/UIKit.h>@interface TableViewController : UITableViewController<UITableViewDataSource,UITabBarDelegate,UIAlertViewDelegate>{ NSMutableArray *a;}- (IBAction)aa:(id)sender;- (IBAction)bb:(id)sender;@end
TableViewController.m部分代码片段
- (IBAction)aa:(id)sender { UIAlertView *a = [[UIAlertView alloc]initWithTitle:@"编辑" message:@"请选择项目" delegate:self cancelButtonTitle:@"Canel" otherButtonTitles:@"Add",@"Delete", nil]; [a show];}- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSString *b = [alertView buttonTitleAtIndex:buttonIndex]; if ([b isEqualToString:@"Delete"]) { [self setEditing:YES]; } if ([b isEqualToString:@"Add"]) { UIAlertView *a1 = [[UIAlertView alloc]initWithTitle:@"添加" message:@"确定要添加联系人吗" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil]; [a1 show]; }}- (IBAction)bb:(id)sender { [self setEditing:NO];}- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ if (editingStyle == UITableViewCellEditingStyleDelete) { [a removeObjectAtIndex:indexPath.row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; }}
0 0
- iOS开发学习之#提醒处理#(1)响应提醒视图
- iOS开发学习之#提醒处理#(2)响应动作表单
- IOS开发 版本提醒
- iOS开发 版本更新提醒
- IOS之日历与提醒
- iOS开发 从下往上弹出提醒视图或日期选择视图等等背景为半透明
- ios 提醒功能开发(应用后台运行消息提醒推送)
- 提醒
- 提醒
- 提醒
- 提醒
- 提醒
- 提醒
- 学习中的自我提醒1
- iOS 开发:应用内实现 更新提醒
- iOS开发 - UIAlertController 弹框提醒
- iOS开发 app版本更新, 提醒
- React-Native学习笔记之代码智能提醒(webstorm)
- 注册表修改PSD关联photoshop
- 利用uboot启动远程Kernel(TFTp)
- Chrome 程序启动
- Using Android's TextureView to Display Video Mirrored
- android 中的4种activity启动模式(launchMode)
- iOS开发学习之#提醒处理#(1)响应提醒视图
- 备忘录模式
- 友盟自定义事件的使用方法
- 嵌入式高手谈嵌入式
- iOS UItableView+UINavigationController实现单元格的删除
- Android DialogFragment fullscreen 解决方法
- 大学在校生4000元起家 大三时身家30万
- hdu 1869
- python 学习笔记(十一)