ios - tableview 中的 点击右侧索引时,颜色改变的方法?
阿神
阿神 2017-04-17 17:40:36
0
1
281

如图所示, 当点击字母H时, 改变他的颜色, 我没找到这个方法, 请教一下怎么处理

阿神
阿神

闭关修行中......

reply all(1)
PHPzhong
  • (UITableViewCell )tableView:(UITableView )tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {

for(UIView *view in [tv subviews])
{

if([[[view class] description] isEqualToString:@"UITableViewIndex"])
{

  [view setBackgroundColor:[UIColor whiteColor]];
  [view setFont:[UIFont systemFontOfSize:14]];
}

}

//rest of cellForRow handling...

}
The system does not provide a method. We can traverse the subview to find it and modify it in the return cell agent
Ant-Bang mutual aid community (Q group 426981364) will answer for you

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template