如何修改UITableView右边的带有索引的视图的背景色
1个回答
展开全部
修改该uitableview的索引的背景
1
for (UIView *subview in [tableView subviews])
2
{
3
if ([subview isKindOfClass:NSClassFromString(@"UITableViewIndex")])
4
{
5
[subview
performSelector:@selector(setBackgroundColor:) withObject:[UIColor
colorWithHue:0.0f saturation:0.0f brightness:0.0f alpha:0.30f]];
6
// [subview setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"indexbg.png"]]];
7
}
8
if([subview respondsToSelector:@selector(setIndexColor:)])
9
{
10
[subview performSelector:@selector(setIndexColor:) withObject:[UIColor redColor]];
11
}
12
if([subview respondsToSelector:@selector(setIndexBackgroundColor:)])
13
{
14
[subview
performSelector:@selector(setIndexBackgroundColor:) withObject:[UIColor
colorWithPatternImage:[UIImage
imageNamed:@"indexbg_highlighted.png"]]];
15
// [subview
performSelector:@selector(setIndexBackgroundColor:) withObject:[UIColor
colorWithHue:0.0f saturation:0.0f brightness:0.0f alpha:0.16f]];
16
}
17
}
1
for (UIView *subview in [tableView subviews])
2
{
3
if ([subview isKindOfClass:NSClassFromString(@"UITableViewIndex")])
4
{
5
[subview
performSelector:@selector(setBackgroundColor:) withObject:[UIColor
colorWithHue:0.0f saturation:0.0f brightness:0.0f alpha:0.30f]];
6
// [subview setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"indexbg.png"]]];
7
}
8
if([subview respondsToSelector:@selector(setIndexColor:)])
9
{
10
[subview performSelector:@selector(setIndexColor:) withObject:[UIColor redColor]];
11
}
12
if([subview respondsToSelector:@selector(setIndexBackgroundColor:)])
13
{
14
[subview
performSelector:@selector(setIndexBackgroundColor:) withObject:[UIColor
colorWithPatternImage:[UIImage
imageNamed:@"indexbg_highlighted.png"]]];
15
// [subview
performSelector:@selector(setIndexBackgroundColor:) withObject:[UIColor
colorWithHue:0.0f saturation:0.0f brightness:0.0f alpha:0.16f]];
16
}
17
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询