在UIActionSheet按钮的文字颜色为蓝色。如何设置为红色或绿色或黑色?
答案 0 :(得分:1)
使用这种简单的方法更改文本颜色。
- (void) changeTextColorForUIActionSheet:(UIActionSheet*)actionSheet
{
UIColor *tintColor = [UIColor redColor];
NSArray *actionSheetButtons = actionSheet.subviews;
for (int i = 0; [actionSheetButtons count] > i; i++)
{
UIView *view = (UIView*)[actionSheetButtons objectAtIndex:i];
if([view isKindOfClass:[UIButton class]])
{
UIButton *btn = (UIButton*)view;
[btn setTitleColor:tintColor forState:UIControlStateNormal];
}
}
}