扫码关注官方订阅号
在
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
方法里,怎样获取到cell所在的sectionHeader以改变颜色?
ringa_lee
可以通过indexPath获取section,然后刷新该section,在headerView的代理里面设置条件就可以更换颜色
(nullable UIView )tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section{
1.实例化一个 view 2.改变view.backgroundColor 3.返回这个view return view;
}
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
可以通过indexPath获取section,然后刷新该section,在headerView的代理里面设置条件就可以更换颜色
(nullable UIView )tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section{
}