Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the size of UIActivityIndicator?

Whatever size i give to it while allocation, it shows fixed size only. Is it possible to increase it?

Code:

activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:                      CGRectMake(142.00, 212.00, 80.0, 80.0)]; [[self view] addSubview:activityIndicator]; [activityIndicator sizeToFit]; activityIndicator.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |                                       UIViewAutoresizingFlexibleRightMargin |                                       UIViewAutoresizingFlexibleTopMargin |                                       UIViewAutoresizingFlexibleBottomMargin); activityIndicator.hidesWhenStopped = YES; activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; 
like image 778
wolverine Avatar asked Apr 14 '10 14:04

wolverine


People also ask

What is UIActivityIndicatorView?

A view that shows that a task is in progress.

How do I display activity indicator in Swift?

Select the Assistant Editor and make sure the ViewController. swift is visible. Ctrl and drag from the Start Button to the ViewController class and create the following Action. Ctrl and drag from the Stop Button to the ViewController class and create the following Action.


1 Answers

The following will create an activity indicator 15px wide:

#import <QuartzCore/QuartzCore.h>  ...  UIActivityIndicatorView *activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease]; activityIndicator.transform = CGAffineTransformMakeScale(0.75, 0.75); [self addSubview:activityIndicator]; 

While I understand the sentiment of TechZen's answer, I don't think adjusting the size of a UIActivityIndicator by a relatively small amount is really a violation of Apple's standardized interface idioms - whether an activity indicator is 20px or 15px won't change a user's interpretation of what's going on.

like image 123
Andrew Vilcsak Avatar answered Sep 23 '22 14:09

Andrew Vilcsak