0

I know how to change the font colour of a UIActionSheet using a tint

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
    [[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[[ColorUtil alloc] colorWithHexString:@"25A559"]];
}

How do I apply it to an item. EG. The first item red, the second item green.

Bcf Ant
  • 1,479
  • 1
  • 13
  • 23

1 Answers1

0

Check my answer

#pragma mark - changeImage
- (IBAction)myActionSheet:(id)sender
{
    UIActionSheet *actionSheet=[[UIActionSheet alloc] initWithTitle : @"Choose Image" delegate : self cancelButtonTitle :@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Gallery",@"Camera",nil];
    actionSheet.tag = 1000;
    [actionSheet showInView :self.view];
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        UIAlertController *alertController = [actionSheet valueForKey:@"_alertController"];
        if ([alertController isKindOfClass:[UIAlertController class]])
        {
            alertController.view.tintColor = [UIColor redColor];// set your color here
        }
    }
}

and for iOS version less than 8.0, use the same old code of UIActionSheet delegate method:

#pragma mark - actionsheet delgates
- (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]; // set your color

        }
    }
}
Maverick
  • 319
  • 2
  • 13