我试图在表视图加载时选择一行。我发现其他线程关于这个问题,但他们没有解决我的问题,所以我再问。无法以编程方式选择UITableViewCell
我的tableview包含5行。而我这样做:
if ([[dataSource objectAtIndex:indexPath.row] isEqualToString:self.status]) {
[self tableView:[self tableView] didSelectRowAtIndexPath:indexPath];
}
我也试过cell.selected = YES;
和cell.highlighted = YES;
。
我使用custion选择视图下面的代码:
UIView *customColorView = [[UIView alloc] init];
customColorView.backgroundColor = [UIColor colorWithRed:180/255.0
green:138/255.0
blue:171/255.0
alpha:0.5];
cell.selectedBackgroundView = customColorView;
请帮我编程选择行。当我点击该行时,该行被选中,但无法以编程方式选择。
didSelectRowAtIndexPath是委托方法。 – Masa