开发学习笔记--UItableView
来源:互联网 发布:闲鱼淘宝介入流程 编辑:程序博客网 时间:2024/05/22 12:24
本文实现UITableView一些常用操作
在.h文件中
在.h文件中
@interface FirstViewController(本文件名) : **ViewController<UITableViewDataSource,UITableViewDelegate>{
NSArray *dataArray;
}
NSArray *dataArray;
}
@end
在.m文件中
UITableView *table = [UITableView alloc]initWithFrame:CGRectMake(0, 64, 320, 450)];
table.delegate = self;
table.dataSource = self;
[self.view addSubview:_table];
dataArray = [NSArray arrayWithObjects:@"Iphone5S",@"Iphone6",@"Iphone6 Plus",@"MacBook air",@"MacBook pro", nil];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"UITableViewCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
//config the cell
cell.textLabel.text = [dataArray objectAtIndex:indexPath.row];
} return cell;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [dataArray count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 80;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//SecondViewController *second = [[SecondViewController alloc]init]; //跳转
//[self.navigationController pushViewController:second animated:YES ];
}
0 0
- 开发学习笔记--UItableView
- iOS开发学习笔记 UITableview
- iOS开发学习笔记——UITableview
- 开发笔记 - UITableView相关
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- UITableView学习笔记
- IOS UITableView 学习笔记
- 简单的android ios抓包技巧
- 德州扑克AI简介——2015华为软件精英赛小结
- memset方法
- 框架模式MVP在Android中的使用
- 湖北英语播音学校预约试听
- 开发学习笔记--UItableView
- 数据库学习记录20150605
- p124 43
- android stack log
- 陈怡暖:今夜非农到底怎么看?闭着眼捡钱吧
- [jQuery] 选择器和事件
- Android-正则校验
- P110
- Vuforia SDK---- AR开发Vuforia sdk 4.0之物体识别