Unable to set / increase the size of UIActivityindicator view

| | August 7, 2015

I m trying to set size of UIActivityindicatorview using setframe. It is able to set position but not size of control. is there some other way??

This is relevant code.

 UIActivityIndicatorView*  mySpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    mySpinner.frame=CGRectMake((375/2)-25,210 , 100, 100);
    mySpinner.color=[UIColor blueColor];
     mySpinner.center =self.view.center;
   mySpinner.hidesWhenStopped = YES;
    [self.view addSubview:mySpinner];

2 Responses to “Unable to set / increase the size of UIActivityindicator view”

  1. It is a standardized interface element so the API does not like to fiddle with it.
    However, you probably could do a scaling to 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.

    But still u can do something like that

    #import <QuartzCore/QuartzCore.h>
    
    ...
    
    UIActivityIndicatorView *activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
    activityIndicator.transform = CGAffineTransformMakeScale(0.75, 0.75);
    [self addSubview:activityIndicator]
    
  2. M Zubair Shamshad on November 30, -0001 @ 12:00 AM

    What i did to change the ActivityIndicator size in app is:

    Just Apply the Transform on your activity indicator and Rescale it.

    Here is the code

    UIActivityIndicatorView*  mySpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    mySpinner.transform = CGAffineTransformMakeScale(1.5, 1.5);
    mySpinner.color=[UIColor blueColor];
    mySpinner.center =self.view.center;
    mySpinner.hidesWhenStopped = YES;
    [self.view addSubview:mySpinner];
    

Leave a Reply