美文网首页
TableView Section Header Title C

TableView Section Header Title C

作者: 景彧 | 来源:发表于2018-01-29 16:19 被阅读37次
#pragma mark - UITableViewDelegate

//! 区头的字体颜色设置
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
    UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
    header.textLabel.textColor = [UIColor blackColor];
    header.contentView.backgroundColor = view.backgroundColor;
}

//! 右侧索引的设置
#pragma mark - 索引的设置

//! 索引标题
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{    
    return self.indexs[section];
}

//! 系统的右侧索引数组
- (NSArray*)sectionIndexTitlesForTableView:(UITableView *)tableView {
    return self.indexs;
}

//! 索引列点击事件
-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
    [self.view endEditing:YES];
    NSString *string = self.indexs[index];
    [self showCenterIndexShowView:string];
    return index;
}

相关文章

网友评论

      本文标题:TableView Section Header Title C

      本文链接:https://www.haomeiwen.com/subject/rvaxzxtx.html