In UIActionSheet button's text colour is blue. How can I set to red or green or black?
Asked
Active
Viewed 413 times
0
-
1possible duplicate of [UIActionSheet button's color](http://stackoverflow.com/questions/4248400/uiactionsheet-buttons-color) – n00bProgrammer Sep 12 '14 at 07:33
-
1possible duplicate of [Change Text color in UIActionSheet Buttons](http://stackoverflow.com/questions/16163737/change-text-color-in-uiactionsheet-buttons) – BHASKAR Sep 12 '14 at 07:37
-
1Useful link http://stackoverflow.com/questions/17946358/how-to-customize-uiactionsheet-ios – Yogendra Sep 12 '14 at 07:39
1 Answers
1
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];
}
}
}

Yogendra
- 1,728
- 16
- 28