这是我的UITableViewCell的.m文件.
- #import "ContentCardTableViewCell.h"
- #import <QuartzCore/QuartzCore.h>
- @implementation ContentCardTableViewCell
- - (void)awakeFromNib {
- // Initialization code
- [self setBackgroundColor:[UIColor clearColor]];
- }
- - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
- [super setHighlighted:highlighted animated:animated];
- if (highlighted) {
- [self setBackgroundColor:[UIColor clearColor]];
- // Recover backgroundColor of subviews.
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- if (selected) {
- [self setBackgroundColor:[UIColor clearColor]];
- // Recover backgroundColor of subviews.
- }
- }
- @end
但是这个UITableViewCell中的一个视图在选择时消失了.我尝试了this和this以及更多但没有任何帮助.有什么我想念的吗?
解决方法
我有类似的问题.
如果我将selectionStyle设置为UITableViewCellSelectionStyleNone工作正常,问题解决了.
即;
如果我将selectionStyle设置为UITableViewCellSelectionStyleNone工作正常,问题解决了.
即;
在里面
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
加
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
在返回牢房之前.希望它有效.