Unable to set / increase the size of UIActivityindicator view
Asked Answered
G

2

5

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];
Gaudy answered 6/8, 2015 at 5:24 Comment(1)
possible duplicate of Can I change the size of UIActivityIndicator?Marrissa
S
14

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];
Scatology answered 6/8, 2015 at 5:27 Comment(0)
L
0

I've added simple extension to use UIActivityIndicatorView with exact size https://mcmap.net/q/195168/-can-i-change-the-size-of-uiactivityindicator

Lexington answered 12/1, 2022 at 20:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.