Thursday, July 24, 2014

Change color of button in UIActionSheet


- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    
    if ([[[UIDevice currentDevice] systemVersion] intValue]>=7) { // Change color of button in actionsheet for iOS 7
        
        if (actionSheet==actionSheetCustom) {
                      
          [[actionSheet layer] setBackgroundColor:[UIColor whiteColor].CGColor];
        
          for (UIView *subview in actionSheet.subviews) {
              if ([subview isKindOfClass:[UIButton class]]) {
                 UIButton *button = (UIButton *)subview;
                
                [button setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"Login-Background.png"]]];
              }
          }
            
        }
    }


}

No comments:

Post a Comment