【发布时间】:2013-02-08 16:07:18
【问题描述】:
我想在另一个 ViewController 的 UITableview 中禁用 UIButton:
我在 SecondViewController 中尝试过,但它只禁用了 _buttonDesc,buttonCell 仍然处于启用状态:
- buttonCell 是 UITableView 内部的 Button。
- buttonDesc 是 SecondViewController 内的 Button Comprar。
。
-(IBAction)comprar
{
[_buttonDesc setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
[_buttonDesc setEnabled:NO];
LivroCell *lvc = [[LivroCell alloc]init];
[lvc.buttonCell setEnabled:NO];
}
【问题讨论】:
-
我不明白您的代码与图像的关系。大概是由第二个 viewController 中的“Comprar”按钮触发的 IBAction。什么是“_buttonDesc”,什么是“LivroCell”?
-
您只是在实例化一个
LivroCell并将它的buttonCell设置为禁用。它不存在于任何地方,您也不会在您的 UI 中看到它。要正确禁用它,您需要获取对LivroCell的现有 实例的引用,然后像您一样禁用它。 -
@HeWas,_buttonDesc 是 ComprarButton,LivroCell 是创建 UITableview 的自定义单元格的类。
标签: objective-c uiviewcontroller ios5 uibutton