UIActionSheet button’s color

iOS 8 (UIAlertController)

It’s super simple to do if you’re using a UIAlertController. Simply change the tint color on the view of the UIAlertController.

[alertController.view setTintColor:[UIColor red];

iOS 7 (UIActionSheet)

I successfully 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];

        }
    }
}

Make sure to run this AFTER you call

[actionSheet showInView];

If you call it before [showInView], all buttons but the cancel button will be colored. Hope this helps someone!

Leave a Comment