2014-01-18 45 views

回答

0

如果我明白你的問題吧,試試下面的代碼:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { 

    UILabel *testLabel = [[UILabel alloc] init]; 
    testLabel.frame = CGRectMake(20, 8, 320, 20); 
    testLabel.font = [UIFont boldSystemFontOfSize:18]; 
    testLabel.text = [self tableView:tableView titleForHeaderInSection:section]; 

    UIView *headerView = [[UIView alloc] init]; 
    [headerView addSubview:testLabel]; 

    return headerView; 
} 
+2

您給出的代碼是段落標題,但是我想要索引代碼,那就是表格右側的字母列表。 – Sami

0

我只是覺得在GitHub上一項偉大的工程,高度可定製的。 MJNIndexView 我希望它能幫助你。