user3360601
user3360601

Reputation: 347

How can I change the colour of the text button in UIActionSheet?

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

Upvotes: 0

Views: 416

Answers (1)

user3432164
user3432164

Reputation:

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];
      }
  }
}

Upvotes: 1

Related Questions