1,UICVIewControl的生命周期
-(void)viewWillAppear:(BOOL)animated{ //将要显示 NSLog(@"viewWillAppear...."); } -(void)viewDidAppear:(BOOL)animated{ NSLog(@"viewDidAppear..."); 显示完成 } -(void)viewWillDisappear:(BOOL)animated{ NSLog(@"viewWillDisappear..."); 将要关闭 } -(void)viewDidDisappear:(BOOL)animated{ NSLog(@"viewDidDisappear..");关闭完成 }
界面显示
2015-12-25 00:07:40.884 viewDemo[517:8149] viewWillAppear....
2015-12-25 00:07:40.927 viewDemo[517:8149] viewDidAppear...
跳转到下一个界面
2015-12-25 00:08:41.575 viewDemo[517:8149] viewWillDisappear...
2015-12-25 00:08:42.111 viewDemo[517:8149] viewDidDisappear..
2,对话框
UIAlertView方式创建
// 添加警告框 UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"确定删除" message:@"删除" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:@"no", nil]; UIActivityIndicatorView *act=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; [alert show]; [alert release];
UIalertControl创建对话框
NSString *title = NSLocalizedString(@"A Short Title Is Best", nil); NSString *message = NSLocalizedString(@"A message should be a short, complete sentence.", nil); NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil); NSString *otherButtonTitle = NSLocalizedString(@"OK", nil); UIAlertController *alert=[UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; //设置Action UIAlertAction *actionleft=[UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { NSLog(@"点击了取消"); }]; UIAlertAction *actionright=[UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSLog(@"点击了确定"); }]; //设置输入框 [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.text=@"代号"; }]; [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.text=@"姓名"; }]; //将事件添加到UIAlertController [alert addAction:actionleft]; [alert addAction:actionright]; // [self presentViewController:alert animated:1 completion:nil]; //释放对象 // [actionleft release]; // [actionright release]; // [alert release];
创建底部对话框
//创建对话款 UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"保存成功" message:@"是否继续" preferredStyle:UIAlertControllerStyleActionSheet]; //添加按钮 [alert addAction:[UIAlertAction actionWithTitle:@"停留本页" style:UIAlertActionStyleCancel handler:nil]]; [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { }]]; //显示对话款 [self presentViewController:alert animated:YES completion:nil];
3,TableView
@interface TableViewController (){ UITableView *table; } @property(strong,nonatomic)NSMutableArray *arrayList1; //数据源 @property (strong,nonatomic)NSMutableArray *arrayTitle;//标题 @property(strong,nonatomic)NSMutableArray *arrayList2; @property(strong,nonatomic)NSDictionary *array; @end @implementation TableViewController @synthesize arrayList1; @synthesize arrayTitle; @synthesize arrayList2; @synthesize array; - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line to preserve selection between presentations. // self.clearsSelectionOnViewWillAppear = NO; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. self.navigationItem.rightBarButtonItem = self.editButtonItem; table=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 430, 600)]; self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"cqe.jpg"]]; // table.dataSource=self; table.delegate=self; if (arrayList1==nil) { arrayList1 =[[NSMutableArray alloc]initWithObjects:@"美元/日元",@"美元/韩元",@"韩元/日元",@"港币/日元",@"美元/欧元",@"美元/英镑",@"美元/新加坡元",@"美元/澳元",@"美元/卢布",@"泰铢/日元",@"英镑/泰铢",@"新加坡元/澳门元",@"美元/港币",@"港币/台币",@"台币/越南盾",@"美元/韩元", nil]; arrayTitle=[[NSMutableArray alloc]initWithObjects:@"自选",@"交叉", nil]; arrayList2=[[NSMutableArray alloc]initWithObjects:@"美元/港币",@"韩元/日元", nil]; array=@{[arrayTitle objectAtIndex:0]:arrayList1, [arrayTitle objectAtIndex:1]:arrayList2}; } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } //设置标题 -(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return [arrayTitle objectAtIndex:section]; } //设置尾部的标题 -(NSString*)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{ return @"这是一个简单的使用"; } //设置头部的高度 -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 20; } //设置底部的高度 -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 100; } //自定义头部View的样式 -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)] autorelease]; [view setBackgroundColor:[UIColor brownColor]];//改变标题的颜色,也可用图片 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 100, 40)]; label.textColor = [UIColor redColor]; label.backgroundColor = [UIColor clearColor]; label.text = [arrayTitle objectAtIndex:section]; [view addSubview:label]; return view; } //设置底部View样式 -(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ UIImageView * v1=[[UIImageView alloc]init]; v1.image=[UIImage imageNamed:@"bk.jpg"]; v1.frame=CGRectMake(0, 0, 320, 100); return v1; } #pragma mark - Table view data source //指定多少分区,根据arrayTitle计算 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { #warning Incomplete implementation, return the number of sections return [arrayTitle count]; } //设置数据 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { #warning Incomplete implementation, return the number of rows //1,根据当前点击的区域设置数据 switch (section) { case 0: return [arrayList1 count]; case 1: return [arrayList2 count]; default: break; } return 0; } //绘制数据 cellForRowAtINdexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; static NSString * string = @"cell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:string]; if(cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:string]; } //根据分区操作 switch (indexPath.section) { case 0: [[cell textLabel] setText:[arrayList1 objectAtIndex:indexPath.row]]; break; case 1: [[cell textLabel] setText:[arrayList2 objectAtIndex:indexPath.row]]; break; default: break; } return cell; } // Override to support conditional editing of the table view. 滑动是否出现删除 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view } } // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } // Override to support conditional rearranging of the - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } //设置行缩进 -(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{ return 3; } //点击事件 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [table deselectRowAtIndexPath:indexPath animated:1];//设置选中后颜色消失 //获得选中的cell // UITableViewCell *cell= [table cellForRowAtIndexPath:indexPath]; //// 添加警告框 // UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"确定删除" message:@"删除" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:@"no", nil]; // // UIActivityIndicatorView *act=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; // // [alert show]; // [alert release]; [self setAlertControlLrean]; } //右侧添加一个索引表 - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ return [self.array allKeys]; } //获得选中的行 -(NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSUInteger index=[indexPath row]; if (index==0) { return nil; } return indexPath; } //获得对话框的点击位置 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSLog(@"%ld",buttonIndex); } //新对话框的使用 -(void)setAlertControlLrean{ NSString *title = NSLocalizedString(@"A Short Title Is Best", nil); NSString *message = NSLocalizedString(@"A message should be a short, complete sentence.", nil); NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil); NSString *otherButtonTitle = NSLocalizedString(@"OK", nil); UIAlertController *alert=[UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; //设置Action UIAlertAction *actionleft=[UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { NSLog(@"点击了取消"); }]; UIAlertAction *actionright=[UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSLog(@"点击了确定"); }]; //设置输入框 [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.text=@"代号"; }]; [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.text=@"姓名"; }]; //将事件添加到UIAlertController [alert addAction:actionleft]; [alert addAction:actionright]; // [self presentViewController:alert animated:1 completion:nil]; //释放对象 // [actionleft release]; // [actionright release]; // [alert release]; } @end
相关推荐
2、使用CHTMLDialog,显示Html页,且能实现HTML动态显示,交互,可以使用C++和javascript互相调用。 3、ADO读取数据库(access),生成HTML,table表格,在CHTMLDialog中显示(目的是HTML的table表格代替MFC的...
包含一个主对话框和两个子对话框(在Tab控件中显示)。常用的MFC控件(包括字体、BMP控件)都可以进行缩放,子对话框的控件也可跟随主对话框大小缩放。单个对话框也适用。界面的控件ID循环查找存入数组中(这样界面...
可以将多个对话框嵌入到一个对话框中,解决一堆控件在一个对话框中的问题。可以做成TABLE页等等。
静态Html、jsp、php等使用element ui 的最简单直观联系,含table样例/对话框样例及所有 js css和图标,学习前台框架很好的入门资源
博客《一个 JS 写的 Table 自增/减行例子,和一个模态对话框传值例子的源代码》一文的示例完整源代码。博客地址:http://blog.csdn.net/defonds/archive/2010/04/21/5512015.aspx。
Qt对话框美化:QTableWidget Qt对话框美化:按钮美化
js删除表单和弹出确认对话框 html 源代码 获取table的td以及其值,弹出警告框
Table of Contents (Core) Sample Project Gradle Dependency Repository Core Commons What's New Basic Dialog Dismissing Dialogs Displaying an Icon Stacked Action Buttons Stacking Behavior Neutral ...
查看位置: elementui的table事件 elementui的table中怎样点击某个单元格触发事件? 可以先看一下官网中table的自定义列模板代码 <el data=tableData xss=removed> 日期 width=180> <el name=time></el> &...
<table width="391" height="332" border="0px" style="margin:0 auto" > 送货地址确认 省份: <td width="195" bgcolor="#FFCCFF"><label for="select"> 北京">北京 湖北省" selected="selected">湖北...
MFC中TAB_Control的用法总结
使用对话框 30 使用仿真信息窗口 30 关闭Proteus ISIS 30 四、菜单命令简述 31 主窗口菜单 31 表格输出窗口(Table)菜单 33 方格输出窗口(Grid)菜单 33 Smith圆图输出窗口(Smith)菜单 33 直方图输出窗口(Histogram)...
主要介绍了vue+elementui实现点击table中的单元格触发事件--弹框,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
先将要打印的数据及样式组织到一个HTML的TABLE元素中, 然后将这个TABLE元素传给webprint,实现分页打印预览,出打印对话框打印和直接打印。 webprint使用简单,灵活.能满足绝大多数页面打印的需要.它内含一个在vc7.0...
1.2 软件结构和使用的工具7 第2章 Android SDK的开发环境10 2.1 Android SDK的结构10 2.2 Android SDK环境安装11 2.2.1. 安装JDK基本Java环境11 2.2.2. 安装Eclipse12 2.2.3. 获得Android SDK12 2.2.4(1). 在...
Yelp for OpenTable将Yelp评论添加到OpenTable餐厅页面和结果中。 Yelp评论旨在补充现有的OpenTable评分,并帮助您决定在哪里用餐。 Yelp评论可以按评分或日期排序。 Yelp徽标可以在餐厅页面上OpenTable的“评论”...
Qt 隐藏边框和移动窗口,代码能直接使用,新手使用,代码比较老了,仅参考思路。现在下载多了分会自动往上涨,高了就评一下,我去改低些
使用easyUI转换HTML table到datagrid 使用easyUI给datagrid添加pagination 使用easyUI添加查询功能在datagrid 使用easyUI 添加toolbar到datagrid 使用easyUI 创建复杂的toolbar到datagrid 使用easyUI 为...
5.单击【航班】按钮,会出现一个Flights Table对话框,在Flights Table对话框中单击OK按钮来接受默认的选择。 6.输入以下信息:(如图示) 名称:Sam Smith 机票数:2 舱位种类:头等舱 7.单击【插入订单】按钮,等待...
File Header, Section Table, Import Table, Export Table 汇编语言调用消息框,制作对话框 汇编语言使用odbc连接数据库 汇编语言扫描硬盘 汇编语言制作位图文件.bmp 汇编语言读取剪切板中的数据 用汇编语言编写病毒 ...