Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (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];
- }
- }
- }
- [actionSheet showInView];
- UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Actionsheet" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
- [actionSheet addButtonWithTitle:@"Button 1"]; //Blue color
- [actionSheet addButtonWithTitle:@"Button 2"];
- [actionSheet addButtonWithTitle:@"Cancel"];
- [actionSheet addButtonWithTitle:nil];
- [actionSheet setCancelButtonIndex:2];
- [actionSheet setDestructiveButtonIndex:1];
- [actionSheet showInView:self.view];
- UIButton *button = [[actionSheet subviews] objectAtIndex:1];
- UIImage *img = [button backgroundImageForState:UIControlStateHighlighted];//[UIImage imageNamed:@"alert_button.png"];
- [button setBackgroundImage:img forState:UIControlStateNormal];
- - (void)willPresentActionSheet:(UIActionSheet *)actionSheet
- {
- for (UIView *_currentView in actionSheet.subviews)
- {
- if ([_currentView isKindOfClass:[UIButton class]])
- {
- UIButton *button = (UIButton *)_currentView;
- [button setTitleColor:YOUR_COLOR forState:UIControlStateNormal];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement