0

In UIActionSheet button's text colour is blue. How can I set to red or green or black?

user3360601
  • 305
  • 3
  • 11
  • 1
    possible duplicate of [UIActionSheet button's color](http://stackoverflow.com/questions/4248400/uiactionsheet-buttons-color) – n00bProgrammer Sep 12 '14 at 07:33
  • 1
    possible 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
  • 1
    Useful link http://stackoverflow.com/questions/17946358/how-to-customize-uiactionsheet-ios – Yogendra Sep 12 '14 at 07:39

1 Answers1

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,712
  • 14
  • 28