вы можете использовать один из UITableViewDelegate
«s метод
func tableView(tableView: UITableView, willDisplayHeaderView view:UIView, forSection: Int) {
if let headerTitle = view as? UITableViewHeaderFooterView {
headerTitle.textLabel?.textColor = UIColor.redColor()
}
}
swift3 и выше
func tableView(_ tableView: UITableView, willDisplayHeaderView view:UIView, forSection: Int) {
if let headerTitle = view as? UITableViewHeaderFooterView {
headerTitle.textLabel?.textColor = UIColor.red
}
}
объективном C
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
if([view isKindOfClass:[UITableViewHeaderFooterView class]]){
UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView *) view;
tableViewHeaderFooterView.textLabel.textColor = [UIColor RedColor];
}
}
для справки я взял модель ответа от here
Да, вы должны добавить ярлык в viewForHeaderInSection. – Janmenjaya
Хе человек, как вы добавили алфавит справа? –
Его называют индексным списком. Heres vid https://www.youtube.com/watch?v=xYSKHna1KJk. Или другая ссылка с большим учебником. http://www.edumobile.org/ios/indexed-table-views-in-swift/ – AMAN77