IOS7 中 UITableView 如何 修改 header的样式和颜色,只需要使用下面的方法就好了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| -(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { NSString *sectionTitle = [[self.list objectAtIndex:section] valueForKey:@"title"]; UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 320.0, 100.0)]; view.backgroundColor = [UIColor lightGrayColor]; UILabel *label = [[UILabel alloc] init]; label.frame = CGRectMake(5.0, 12.0, 284.0, 24.0); label.textColor = [UIColor blackColor]; label.font = [UIFont systemFontOfSize:16.0]; label.text = sectionTitle; label.backgroundColor = [UIColor clearColor]; [view addSubview:label]; return view; }
|