iphone - 如何更改 UIAlertView 中的按钮颜色

标签 iphone ios4 iphone-sdk-3.0

我有一个带有几个按钮的 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/

相关文章:

iphone <-> 现实世界连接

ios - 如何克服这个 0 objc_msgSend

iPhone SDK : After invalidating a Timer, 我怎样才能再次使用它?

iphone - Objective-C 正确复制 NSArray?

iphone - CoreData删除对象

iphone - 如何在 iOS 上使用 Dropbox API 响应成功登录?

android - 是否可以在 iOS 或 Android 上的另一个应用程序中嵌入下载按钮 - 而无需离开原始应用程序?

xcode - resignFirstResponder 没有在 textFieldShouldReturn 上隐藏键盘

iphone - NSDateFormater 日期从字符串 :

iphone - 如何自动释放 CGColorRef