我想在另一个ViewController的UITableview中禁用UIButton:
我试过,在SecondViewController中,但它只禁用_buttonDesc,buttonCell仍然启用:
。
-(IBAction)comprar
{
[_buttonDesc setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
[_buttonDesc setEnabled:NO];
LivroCell *lvc = [[LivroCell alloc]init];
[lvc.buttonCell setEnabled:NO];
}
答案 0 :(得分:0)
您需要引用要禁用的实际buttonCell。创建LivroCell的新实例对您没有帮助。
最简单的方法是当有人点击"购买"按钮,然后创建新的UIViewController,传递对购买按钮的引用(如果"购买"调用IBAction然后将发送者传递给您创建的子视图控制器)。因此,在子视图控制器上创建一个属性来存储按钮,在执行alloc / init时设置该属性,然后以后很容易禁用它。