我试图更改滑动 UITableViewCell 行时出现的视图的背景颜色,即“删除”按钮后面的背景颜色。
我尝试更改 cell.editingAccessoryView 但这没有做任何事情。
UIView* myBackgroundView = [[UIView alloc] initWithFrame:CGRectZero];
myBackgroundView.backgroundColor = [UIColor clearColor];
cell.editingAccessoryView = myBackgroundView;
有任何想法吗?
我回答这个问题是因为我花了一段时间才找到答案,这是搜索中出现的第一个条目。通过使用willDisplayCell
方法您可以访问单元格背景颜色。注意[UIColor clearColor];
将返回白色,因此请相应地调整您的代码。
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor blackColor];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)