How to change text color for Section Headers in a Grouped TableView in iPhone SDK?

后端 未结 7 1465
情深已故
情深已故 2020-12-14 08:10

I am making an iPhone app where in I have a grouped TableView with headers for the sections.

Problem is that I want to change the Section Header\'s text color.

相关标签:
7条回答
  • 2020-12-14 09:12
     - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
      UILabel *myLabel = [[UILabel alloc] init];
      myLabel.frame = CGRectMake(20, 8, 220, 20);
      myLabel.font = [UIFont boldSystemFontOfSize:16];
      myLabel.text = [self tableView:tableView 
      titleForHeaderInSection:section];
      myLabel.backgroundColor=[UIColor grayColor];
      UIView *headerView = [[UIView alloc] init];
      [headerView addSubview:myLabel];
      return headerView;
      }
    
    0 讨论(0)
提交回复
热议问题