Custom UIActivityIndicatorView

2

You can change the element of a UIActivityIndicatorView by a gif specific? How?

    
asked by anonymous 05.05.2014 / 23:13

1 answer

3

I recommend using MBProgressHUD
This library has several types of progress indicators already implemented and also allows you to define a custom view, with the customView property. For example, assuming your custom view is called customImageView , the code would look something like this:

MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.customView = customImageView;
HUD.mode = MBProgressHUDModeCustomView;
[HUD show:YES];

To create the gif, I suggest using this category: link You can also use the animationImages property of UIImageView by assigning an array of UIImage objects:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
imageView.animationImages = @[[UIImage imageNamed:@"img_01.png"], [UIImage imageNamed:@"img_02.png"],[UIImage imageNamed:@"img_03.png"]];
imageView.animationRepeatCount = 1;
[imageView startAnimating];
    
06.05.2014 / 10:02