0

我目前正在启用和禁用 UIViewController 上的按钮。我发现我第一次更改它们的启用状态时,它们会响应,但随后按钮将启用或禁用,但它们在表单上的外观不会更新。

这意味着在我调用我的方法后,按钮启用但它们的外观不会改变。

我在没有 alpha 位的情况下这样做,但我遇到了同样的问题。我尝试添加 alpha 的代码作为解决方法,但没有任何乐趣。

任何帮助表示赞赏。

-(void)enableValidButtons
{
serverAuthentication *login = [serverAuthentication sharedServerAuthentication];

BOOL enabled =login.userAuthenticated;
float alpha;
if (enabled){
    alpha = 1.0;
}else{
    alpha = 0.5;
}

_shiftLogButton.enabled = enabled;
_shiftLogButton.alpha = alpha;
_scanButton.enabled = enabled;
_scanButton.alpha = alpha;
_rebuildButton.enabled = enabled;
_rebuildButton.alpha = alpha;

[self.view layoutSubviews];
}
4

0 回答 0