왜 이것이 올바르게 작동하지 않는지 말할 수 있습니까?UIView 배경색이 적용되지 않습니다.
tableView:didSelectAtIndexRowPath:
메서드의 표보기 셀 내에 아래 코드 줄이 있습니다.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[[tableView viewWithTag:199]removeFromSuperview];
CGSize cellSize = [tableView cellForRowAtIndexPath:indexPath].frame.size;
UIView *subSelectionView = [[UIView alloc]initWithFrame:CGRectMake(10, 0, (int)cellSize.width - 20, 100)];
[subSelectionView setBackgroundColor:[UIColor blueColor]];
subSelectionView.layer.borderColor = [UIColor grayColor].CGColor;
subSelectionView.layer.borderWidth = 1;
subSelectionView.tag = 199;
[[tableView cellForRowAtIndexPath:indexPath]addSubview:subSelectionView];
}
공지 코드 :
[subSelectionView setBackgroundColor:[UIColor blueColor]];
분명히, 나는 내가 UITableViewCell
에 추가 된 서브 뷰의 색상을 변경하고 싶지만 왜 작동하지?
'subSelectionView'가 테이블 뷰 셀의 콘텐트 뷰에 의해 커버되지 않는지 확인하십시오. – Costique