基本的tableView 資料設定與使用就略過不提.
tableView可以分多項scetion,在各header分類時可以設定header來明顯標示出section的段落.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
//這邊return的就是各section上的header return @"Header";
}
{
//這邊return的就是各section上的header return @"Header";
}
然後如果想在tableView右邊顯示index 可以快速跳越到某section.
加入底下的函式. 並自定各自要顯示的index的title
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
NSArray* sIndex = [[NSArray alloc] initWithObjects:@"0-9", @"A", @"中", @"日", @"法", @"德", nil];
return [sIndex autorelease];
}
NSArray* sIndex = [[NSArray alloc] initWithObjects:@"0-9", @"A", @"中", @"日", @"法", @"德", nil];
return [sIndex autorelease];
}
沒有留言:
張貼留言