在以下任何一種方法中設置backgroundView和selectedBackgroundView似乎都不起作用。設置UITableViewCell backgroundView和selectedBackgroundView在iOS7中不起作用
UIView * bSg = [[UIView alloc] init];
UIView * bg = [[UIView alloc] init];
UIImageView *topSImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bgActive"]];
UIImageView *topImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg"]];
[bg addSubview:topImage];
[bSg addSubview:topSImage];
self.backgroundView = bg;
self.selectedBackgroundView = bSg;
試過在所有這些細胞的方法
- (void)layoutSubviews
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
- (id)init
放在layoutSubviews
當它工作第一次加載的時候,卻選擇細胞時沒有發生(又名selectedBackgroundView未設置)設置。
是的,我已經在layoutSubviews設置self.backgroundColor = [UIColor clearColor]
清除iOS7白色
所以這個問題是這樣的tableview類從通過設置其細胞中的類繼承類方法(+)。然後我的tableview甚至沒有使用cellForRowAtIndex方法,不知道爲什麼他們這樣構建它。經過幾個小時的代碼篩選之後,我發現了被調用的cellForRowAtIndex,並修改了它。以下需要實現(cell.selectionStyle = UITableViewCellSelectionStyleDefault;) – jdog