【发布时间】:2018-01-08 05:33:29
【问题描述】:
我在使用表格视图 didSelect 方法和 prepareForSegue 时遇到问题。我在我的应用中使用了 SWRevealController。选择单元格时,它会显示视图。 有时它无法正常工作。需要点按两次才能显示视图。几个月前,我使用了旧的显示视图框架,其中包含执行块操作。它工作得很好。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
for (int i=0; i<6; i++)
{
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
if (i == indexPath.row)
{
cell.contentView.backgroundColor = [UIColor colorWithRed:KColorRedSelected green:KColorGreenSelected blue:KColorBlueSelected alpha:1];
}
else
{
cell.contentView.backgroundColor = [UIColor colorWithRed:KColorRed green:KColorGreen blue:KColorBlue alpha:1];
}
}
}
【问题讨论】:
-
你能出示你的
didSelect代码吗 -
你为什么使用
for (int i=0; i<6; i++) -
更改单元格颜色。
-
您是否在使用 tableview 的类中添加了任何手势或触摸事件方法?
-
@surjeet 不,我没有使用任何手势动作。
标签: ios objective-c swrevealviewcontroller