White text on a UITextView action sheet

161 Views Asked by At

When tapping and holding an action sheet or menu controller shows up but the text is white, what could be causing this?

screenshot

3

There are 3 best solutions below

1
On

In this case it was

self.window.tintColor = [UIColor whiteColor];

in the AppDelegate.

Although I'm sure it could be on the UIAlertController or UIActionSheet in other cases. 0yeoj's answer of checking the tint on the UIAlertController lead me in the right direction.

0
On

Check for any override that maybe causing the problem.

Look for something like this in IOS7 delegate - willPresentActionSheet: to change colors..

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
    for (UIView *subview in actionSheet.subviews) {

        if ([subview isKindOfClass:[UIButton class]]) {

            UIButton *button = (UIButton *)subview;
            [button setTitleColor: [UIColor whiteColor] forState:UIControlStateNormal];

        }
    }
}

in iOS8 it's something like this i think:

UIAlertController *alertController = [actionSheet valueForKey:@"_alertController"];
if ([alertController isKindOfClass:[UIAlertController class]])
{
    alertController.view.tintColor = [UIColor whiteColor];
}

Edit

I was searching and testing maybe it was..

enter image description here

Under - (BOOL)application:didFinishLaunchingWithOptions try checking it out..

0
On

You need to set following appearance for UIAlertController class for IOS 8.

[[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor redColor]];

Another solution for IOS7+

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
    for (UIView *subview in actionSheet.subviews) {
        if ([subview isKindOfClass:[UIButton class]]) {
            UIButton *button = (UIButton *)subview;
            [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        }
    }
}

May this help to solve your problem.