// 给 “a,b,c... 定位栏添加背景。。。。”
可以放在这个方法里面 //
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
for(UIView *view in [aTableView subviews])
{
if([[[view class] description] isEqualToString:@"UITableViewIndex"])
{
//[view setBackgroundColor:RGB(40, 40, 40)];
//[view setBackgroundColor:[UIColor blackColor]];
//[view setFont:[UIFont systemFontOfSize:14]];
// [view setBackgroundColor:[UIColor colorWithRed:100 green:100 blue:100 alpha:0]];
}
}
}
///-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// 修改 层的 背景色。。。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
UIView* myView = [[UIView alloc] init];
myView.frame = CGRectMake(0, 0, 200, 22);
myView.backgroundColor = RGB(65, 65, 65);
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 200, 22)];
titleLabel.textColor=[UIColor whiteColor];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = sectionTitle;
if ([titleLabel.text length]==0){
return nil;
}
//
[myView addSubview:titleLabel];
UIView *blackLine = [[UIView alloc] initWithFrame:CGRectMake(0, 21, 320, 1)];
blackLine.backgroundColor = RGB(20, 20, 20);
[myView addSubview:blackLine];
UIView *whiteLine = [[UIView alloc] initWithFrame:CGRectMake(0, 20, 320, 1)];
whiteLine.backgroundColor = RGB(60, 60, 60);
[myView addSubview:whiteLine];
return myView;
}