UITableView titleForHeader默认的文字都是灰色加阴影的,
如果换了其它BackgroundImage的话,就不搭了。
修改方法如下:
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
-
- NSString *HeaderString = nil;
-
- switch (section) {
- case 0:
- HeaderString = [NSString stringWithFormat:@"Header Text 1"];
- break;
- case 1:
- HeaderString= [NSString stringWithFormat:@"Header Text 2"];
- break;
- case 2:
- HeaderString = [NSString stringWithFormat:@"Header Text 3"];
- break;
- }
-
- UILabel *HeaderLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
- HeaderLabel.backgroundColor = [UIColor clearColor];
- HeaderLabel.font = [UIFont boldSystemFontOfSize:18];
- HeaderLabel.textColor = [UIColor whiteColor];
- HeaderLabel.text = HeaderString;
-
- return HeaderLabel;
- }
|