-1

This is my code that I have written in my project. Instead of a spinner I want to show an image.

progress= [[UIActivityIndicatorView alloc] initWithFrame: CGRectMake(125, 50, 30, 30)]; progress.backgroundColor = [UIColor redColor]; progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [self.view bringSubviewToFront:progress]; 
2

3 Answers 3

1

You can not do that as UIActivityIndicatorView is the system activity indicator. So if you want to do that then either you can create custom view for the same OR UIImageView supports animating several images in a loop(for, while) OR you can also add gif image for animation instead of UIActivityIndicatorView.

Sign up to request clarification or add additional context in comments.

1 Comment

"UIImageView supports animating several images in a loop(for, while) " - actually, I don't think you can animate the frames manually. You call the methods startAnimating() and stopAnimating().
0

Put this code in your viewDidload() . BuildingIcon_ImageView is my imageview and when your image you want to load after set image hide UIActivityIndicatorView.

Code :

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; [indicator startAnimating]; [indicator setCenter:BuildingIcon_ImageView.center]; [BuildingIcon_ImageView addSubview:indicator]; BuildingIcon_ImageView.image=image; [indicator removeFromSuperview]; 

Comments

0

i have resolved my issue long back , posting lately this is my answer it may helpful for other thats why i am posting here.

by using NVActivityIndicatorView i resolved my problem .NVActivityIndicatorView we can choose number of custom designs.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.