Can I change the size of UIActivityIndicator? Can I change the size of UIActivityIndicator? ios ios

Can I change the size of UIActivityIndicator?


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.


Swift 3.0 & Swift 4.0

self.activityIndi.transform = CGAffineTransform(scaleX: 3, y: 3)


The size is fixed by the style. It's a standardized interface element so the API doesn't like to fiddle with it.

However, you probably could do a scaling transform on it. Not sure how that would affect it visually, however.

Just from a UI design perspective, its usually better to leave these common standardized elements alone. User have been taught that certain elements appear in a certain size and that they mean specific things. Altering the standard appearance alters the interface grammar and confuses the user.