Customizing Uiactivityindicatorview

Asked

Viewed 64 times

2

It is possible to swap the widget
(source: iab.net.) of a UIActivityIndicatorView by a specific gif? How?

1 answer

3


I recommend using the Mbprogresshud
This library has several types of progress indicators already implemented and also allows you to define a custom view, through the property customView. For example, assuming your custom view is called customImageView, the code would look 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 gif, I suggest using this category: https://github.com/mayoff/uiimage-from-animated-gif You can also use the property animationImagesof Uiimageview, assigning an array of objects UIImage:

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];

Browser other questions tagged

You are not signed in. Login or sign up in order to post.