How to set rich text properties in a UITableView footer?

I use

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
  if ( section == 0 )
  {
    return NSLocalizedString(@"Section_0_text", @"");
  }
  if ( section == 1 )
  {
    return NSLocalizedString(@"Section_1_text","");
  }
  return nil;  
}

Can I change the font, color, and other properties of the text of the return line?

+3
source share
3 answers

Take a look at the class UITableViewDelegate, in particular the methods tableView:viewForFooterInSection:and the tableView: heightForFooterInSection: . You can return any view you want, including but not limited to - a UILabelwith any text properties you want.

+5
source

Use the following to return your own view with custom text color, etc.

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
+2
source

, willi, , - . UILabel, , . , Apple API docs .

. , (, UILabel ) Tableview: viewForFooterInSection: .

+2

Source: https://habr.com/ru/post/1720620/


All Articles