0

i wanted to change buttons color in action sheet so i wrote this code

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
     for (UIView *_currentView in actionSheet.subviews) {
         if ([_currentView isKindOfClass:[UIButton class]]) {

            UIButton *button = (UIButton *)_currentView;
            button.titleLabel.textColor = [UIColor darkGrayColor];
            NSLog(@"%@",@"ahmed");
        }
    }
}

but nothing happen although i made delegate to self and called UIActionSheetDelegate . although i have 6 buttons ,i see as this function wasn't be called at all what is the problem?????

vikingosegundo
  • 51,126
  • 14
  • 131
  • 172
user3045517
  • 61
  • 1
  • 8
  • possible duplicate of [UIActionSheet button's color](http://stackoverflow.com/questions/4248400/uiactionsheet-buttons-color) – rishi Feb 25 '15 at 06:23
  • this didnt work for me too – user3045517 Feb 25 '15 at 06:37
  • I guess this changes can't be made in the willPresent. You need to make the customization before the call for presenting the action sheet. – Ashraf Tawfeeq Feb 25 '15 at 08:10
  • i see other developers in other questions made it in stackoverflow – user3045517 Feb 25 '15 at 09:41
  • i made this also - (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]; } } } – user3045517 Feb 25 '15 at 09:43

0 Answers0