2014-01-18 80 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 我希望它能帮助你。