iOS开发学习之#表视图#(4)填充Grouped风格的分组表
来源:互联网 发布:万网已备案域名 编辑:程序博客网 时间:2024/05/15 04:26
直接上代买吧:
@implementation ViewController- (void)viewDidLoad { a = [NSArray arrayWithObjects:@"ant",@"alpaca",@"albatross", nil]; b = [NSArray arrayWithObjects:@"badger",@"bat",@"bear", nil]; c = [NSArray arrayWithObjects:@"cat",@"calf",@"cattle", nil]; d = [NSArray arrayWithObjects:@"A",@"B",@"C", nil]; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.}//设置表视图的行数- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 3;}- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } if (indexPath.section == 0) { cell.textLabel.text = [a objectAtIndex:indexPath.row]; } if (indexPath.section == 1) { cell.textLabel.text = [b objectAtIndex:indexPath.row]; } if (indexPath.section == 2) { cell.textLabel.text = [c objectAtIndex:indexPath.row]; } return cell;}//设置表视图的节数- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return [d count];}//获取节的名称- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ return [d objectAtIndex:section];}
0 0
- iOS开发学习之#表视图#(4)填充Grouped风格的分组表
- iOS开发学习之#表视图#(5)填充Plain风格的分组表
- iOS开发学习之#表视图#(1)删除行
- iOS开发学习之#表视图#(2)添加行
- iOS开发学习之#表视图#(3)移动行
- IOS学习笔记(十一)之IOS开发之表视图(UITableView)的基本介绍(一)
- IOS学习笔记(十一)之IOS开发之表视图(UITableView)的基本介绍(一)
- IOS学习笔记(十二)之IOS开发之表视图(UITableView)的讲解与使用(二)
- IOS学习笔记(十一)之IOS开发之表视图(UITableView)的基本介绍(一)
- iOS学习笔记——表视图四(分组分区)
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)城市列表
- iOS学习之分段Table View的使用(Grouped样式表格)
- iOS学习之分段Table View的使用(Grouped样式表格)
- 小K拆解
- 这8个多月
- 2014.12.1 格式化后页面不能正常显示的bug
- arm-linux-gcc 常用参数讲解 gcc编译器使用方法
- UVA - 401-Palindromes
- iOS开发学习之#表视图#(4)填充Grouped风格的分组表
- Java 中 HashMultimap(guava)笔记
- TabHost中嵌套ScrollView的简单样例
- 使用Windbg分析程序死锁小结
- akka 与kafka
- ios判断手机号码
- 自我积累之一--遇到的linux网络问题
- Toast用法大全
- ARM+Linux下看门狗应用