Могу ли я использовать gif-образ вместо загрузки по умолчанию? Я использую этот код до сих пор, но не получаю никакого результата. может ли кто-нибудь предположить, что не так в этом коде?MBProgreeHud with gif image
#import "UIImage+GIF.h"
-(void) showLoadingHUD:(NSString *)title
{
[self hideLoadingHUD];
if(!HUD){
HUD = [MBProgressHUD showHUDAddedTo:self.window animated:YES];
}
[HUD setColor:[UIColor clearColor]];
UIImageView *imageViewAnimatedGif = [[UIImageView alloc]init];
imageViewAnimatedGif.image= [UIImage sd_animatedGIFNamed:@"martini_glass"];
HUD.customView = [[UIImageView alloc] initWithImage:imageViewAnimatedGif.image];
CABasicAnimation *rotation;
rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotation.fromValue = [NSNumber numberWithFloat:0];
rotation.toValue = [NSNumber numberWithFloat:(2 * M_PI)];
rotation.duration = 0.7f; // Speed
rotation.repeatCount = HUGE_VALF; // Repeat forever. Can be a finite number.
[HUD.customView.layer addAnimation:rotation forKey:@"Spin"];
HUD.mode = MBProgressHUDModeCustomView;
[HUD show:YES];
}
проверить это: https://www.cocoacontrols.com/controls/gifprogresshud –
@ AnthonyRaphel проверил это. Я хочу знать, могу ли я реализовать это с помощью MBProgressHUD. – Niharika
код добавлен как ans –