Is it possible to have buttons in UIActionSheet
in iOS 7's tintColor
color? I mean if my app is in brand tintColor
, for example red, I don't want blue buttons in action sheet. The same with UIAlertView
.
I want to stress that this violates Apple's rules, but this works:
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
[actionSheet.subviews enumerateObjectsUsingBlock:^(UIView *subview, NSUInteger idx, BOOL *stop) {
if ([subview isKindOfClass:[UIButton class]]) {
UIButton *button = (UIButton *)subview;
button.titleLabel.textColor = [UIColor greenColor];
NSString *buttonText = button.titleLabel.text;
if ([buttonText isEqualToString:NSLocalizedString(@"Cancel", nil)]) {
[button setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
}
}
}];
}
(conform to UIActionSheetDelegate
)
Not tried UIAlertView yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With