Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 是否根据UITableView选择更改图层背景属性?_Ios - Fatal编程技术网

Ios 是否根据UITableView选择更改图层背景属性?

Ios 是否根据UITableView选择更改图层背景属性?,ios,Ios,我有一个具有两层(顶层和底层)的视图控制器。在底层,我有一个UITableView。我想更改顶层显示的按钮/标签,具体取决于在表视图中选择的按钮/标签。我觉得这样应该行得通: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 0) { self.topLayer.backgro

我有一个具有两层(顶层和底层)的视图控制器。在底层,我有一个UITableView。我想更改顶层显示的按钮/标签,具体取决于在表视图中选择的按钮/标签。我觉得这样应该行得通:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    if (indexPath.section == 0)
    {
        self.topLayer.backgroundColor = [UIColor redColor];
    } 

}

但每次我运行它,并在tableview中选择第一项时,它都会出错(是的,我已经定义并合成了topLayer和BottomLayer)。有什么想法吗

是的,去掉你的断点就可以解决了。 断点,比如说运行到这里的所有东西。然后停下来。
它应该可以工作。

有错误代码吗?调试器有什么问题吗?我得到一个“线程1:在断点3处停止:”错误,并且是一个绿色条,突出显示“self.topLayer.backgroundColor…”代码行。它不是崩溃。删除断点。