@@ -443,20 +443,37 @@ - (void)updateViewsForColor:(UIColor *)color {
443443
444444 UIView *indicator = self.indicator ;
445445 if ([indicator isKindOfClass: [UIActivityIndicatorView class ]]) {
446- UIActivityIndicatorView *appearance = [UIActivityIndicatorView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
446+ UIActivityIndicatorView *appearance = nil ;
447+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
448+ appearance = [UIActivityIndicatorView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
449+ #else
450+ // For iOS9+
451+ appearance = [UIActivityIndicatorView appearanceWhenContainedInInstancesOfClasses: @[[MBProgressHUD class ]]];
452+ #endif
453+
447454 if (appearance.color == nil ) {
448455 ((UIActivityIndicatorView *)indicator).color = color;
449456 }
450457 } else if ([indicator isKindOfClass: [MBRoundProgressView class ]]) {
451- MBRoundProgressView *appearance = [MBRoundProgressView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
458+ MBRoundProgressView *appearance = nil ;
459+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
460+ appearance = [MBRoundProgressView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
461+ #else
462+ appearance = [MBRoundProgressView appearanceWhenContainedInInstancesOfClasses: @[[MBProgressHUD class ]]];
463+ #endif
452464 if (appearance.progressTintColor == nil ) {
453465 ((MBRoundProgressView *)indicator).progressTintColor = color;
454466 }
455467 if (appearance.backgroundTintColor == nil ) {
456468 ((MBRoundProgressView *)indicator).backgroundTintColor = [color colorWithAlphaComponent: 0.1 ];
457469 }
458470 } else if ([indicator isKindOfClass: [MBBarProgressView class ]]) {
459- MBBarProgressView *appearance = [MBBarProgressView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
471+ MBBarProgressView *appearance = nil ;
472+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
473+ appearance = [MBBarProgressView appearanceWhenContainedIn: [MBProgressHUD class ], nil ];
474+ #else
475+ appearance = [MBBarProgressView appearanceWhenContainedInInstancesOfClasses: @[[MBProgressHUD class ]]];
476+ #endif
460477 if (appearance.progressColor == nil ) {
461478 ((MBBarProgressView *)indicator).progressColor = color;
462479 }
0 commit comments