我的 View 上有 2 个按钮,我想在单击另一个按钮时禁用第一个按钮,并在再次单击该按钮时禁用第二个按钮。
我试过这个代码
if (button1.enable = NO) {
button2.enable = NO;
}
所以我在 NavigationBar 中有一个“+”按钮和 5 个禁用按钮。
当我按下“+”按钮时,我想启用第一个按钮,当我再次按下启用第二个按钮时……
谢谢
最佳答案
if (button1.enabled == YES)
{
button1.enabled = NO;
button2.enabled = YES;
}
else (button2.enabled == YES)
{
button2.enabled = NO;
button1.enabled = YES;
}
那是你要找的吗?这将是另一个按钮的 IBAction。
关于ios - 如何禁用多个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3489030/