Может кто-нибудь сказать мне, почему это не работает правильно?
У меня есть эти строки кода в ячейке табличного представления для метода 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
, но почему оно не работает?