如何修改UITableView右边的带有索引的视图的背景色
2个回答
2015-06-26
展开全部
修改该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
}
缘博客版权所有,转载请注明来自缘的博客。
推荐于2016-08-25
展开全部
修改该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
}
缘博客版权所有,转载请注明来自缘的博客。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询