我有一个带有几个按钮的 UIAlertView。我想让某个按钮变成红色。我怎样才能做到这一点?
最佳答案
虽然最初的问题是如何更改 UIAlertView 按钮颜色,但随后将其更改为 UIActionSheet,因此如果有人想要更改 UIActionSheet 按钮颜色,可以使用以下 UIActionSheet 委托(delegate)方法:
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
for (UIView *aView in actionSheet.subviews) {
UIButton *aButton = (UIButton *)aView;
[aButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
关于iphone - 如何更改 UIAlertView 中的按钮颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6911355/