Ios 是否根据UITableView选择更改图层背景属性?
我有一个具有两层(顶层和底层)的视图控制器。在底层,我有一个UITableView。我想更改顶层显示的按钮/标签,具体取决于在表视图中选择的按钮/标签。我觉得这样应该行得通:Ios 是否根据UITableView选择更改图层背景属性?,ios,Ios,我有一个具有两层(顶层和底层)的视图控制器。在底层,我有一个UITableView。我想更改顶层显示的按钮/标签,具体取决于在表视图中选择的按钮/标签。我觉得这样应该行得通: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { self.topLayer.backgro
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
self.topLayer.backgroundColor = [UIColor redColor];
}
}
但每次我运行它,并在tableview中选择第一项时,它都会出错(是的,我已经定义并合成了topLayer和BottomLayer)。有什么想法吗 是的,去掉你的断点就可以解决了。 断点,比如说运行到这里的所有东西。然后停下来。
它应该可以工作。有错误代码吗?调试器有什么问题吗?我得到一个“线程1:在断点3处停止:”错误,并且是一个绿色条,突出显示“self.topLayer.backgroundColor…”代码行。它不是崩溃。删除断点。