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

时间:2012-02-16 04:39:56

标签: ios

我有一个有两层的视图控制器(topLayer和BottomLayer)。在底层,我有一个UITableView。我想更改topLayer上显示的按钮/标签,具体取决于在表格视图中选择的内容。我认为这样的事情应该有效:

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

}

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

1 个答案:

答案 0 :(得分:0)

是的,删除你的断点,应该修复它。 断点,比如把一切都运到这里。然后停下来。 它应该工作。