[英]How can I change the colour of the text button in UIActionSheet?
In UIActionSheet button's text colour is blue. 在UIActionSheet中,按钮的文本颜色为蓝色。 How can I set to red or green or black? 如何设置为红色,绿色或黑色?
Change the text color by using this simple method. 通过使用这种简单的方法来更改文本颜色。
- (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];
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.