iphone tableView的使用(zz)
来源:互联网 发布:js 对象类型 编辑:程序博客网 时间:2024/05/21 17:59
tableView的使用主要处理代码
1.新建UIViewController页面,双击xib文件,打开布局视图
2.将Libery视图中的Table View拖到view窗口
3.单击view中的Tableview,control+F2,分别将dataSource和delegate和tableview fileowner关联
4.在页面中处理table数据显示
//测试数据
NSArray *listData;
NSArray *arry=[[NSArray alloc]
initWithObjects:@"列表item1",@"列表item2",@"列表item3",@"列表item4"
,nil
];
self.listData=arry;
[arry release];
/*
* 获得 lsitview 的 size ,就是 listview 的行数
* Get ListView size;
*/
-(NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section{
return [self.listData count];
}
/********************
* 开始循环画 listview
*Draw Listview
*****************/
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *SimpleTableIddentifier=@"SimpleTableIndentifier";//table 标志符
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIddentifier];
if(cell==nil){
cell=[[[UITableViewCell alloc]
initWithStyle: UITableViewCellStyleDefault //table 风格
reuseIdentifier:SimpleTableIddentifier //table 标志符
] autorelease];
}
// 为每行添加一个 tupian ,建议图片资源预先处理好,直接调用,此处现取不建议
UIImage *image =[UIImage imageNamed:@"green_dot.png"];
cell.imageView.image=image;
NSUInteger row=[indexPath row];
cell.textLabel.text=[ listData objectAtIndex:row]; //此处导入数据源
UILabel* cellLabel = [cell textLabel];
[cellLabel setFont:[UIFont fontWithName:@"Marker Felt" size:20]];
[cellLabel setTextColor:[UIColor whiteColor]];
[cellLabel setBackgroundColor:[UIColor clearColor]];
return cell;
}
/*
处理 list 的选择事件
* Deal select index
*/
-(NSIndexPath *)tableView:(UITableView *)tableView
willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSInteger row =[indexPath row];
tab_myZone_AlterInfor *alterPage;// 修改账号信息页面定义
switch (row) {
case 0:
// 获取修改账号信息页面
alterPage=[[tab_myZone_AlterInfor alloc] initWithNibName: @"tab_myZone_AlterInfor" bundle:nil];
self.alterInforPage=alterPage;
[alterPage release];
[self.navigationController pushViewController:self.alterInforPage animated:YES ];
break;
default:
break;
}
return indexPath;
}
- iphone tableView的使用(zz)
- iphone tableView的使用
- Iphone TableView 使用实现
- iphone的tableview滑动删除
- [iphone]tableview
- iPhone TableView中图片的延时加载
- iPhone TableView中图片的延时加载
- iPhone TableView中图片的延时加载
- 只有一个tableview的iphone适配
- TableView的使用
- Tableview的使用
- 简单tableView的使用
- ios tableView 的使用
- TableView的基本使用
- TableView的详细使用
- COCOS2DX - TableView的使用
- swift- tableView 的使用
- TableView的使用
- c++画圆的程序
- java读取mysql数据库中文乱码问题
- Android实战技巧:数据存储方式
- 【LINUX】:真正的初学者常用命令(仅限Lunix)
- c++ map 函数
- iphone tableView的使用(zz)
- 【LINUX】:简单实现Windows和Linux文件共享
- javascript学习笔记(一)
- 无题
- linux 解压大全
- 写个心得
- JDBC操作数据库的几种方式。
- 为什么银行查不到你的身份信息?
- IBM发布其分布式存储–XIV