Repeated UIActivityIndicatorView counter

I am trying to get my first counter to work, and I cannot get it to appear on the screen.

I tried dragging the UIActivityIndicatorView onto the storyboard onto my screen, but then when I tried to connect it to the header file via the storyboard, it did not seem to respond. (what are the right steps?)

So, I did it manually. I added this line to the .h file:

@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *aSpinner; 

and then I added these lines to my .m file

 UIActivityIndicatorView *aSpinner; //throw up spinner from submit btn we created aSpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge]; [self.view addSubview:aSpinner]; [aSpinner startAnimating]; 

but when I ran the test, none of them appeared. Any thoughts on what I'm doing wrong here?

0
source share
2 answers

Select your spinner in the nib file with the right mouse button -> click and drag it with a link to the file owner. Then select aSpinner.

It is not displayed because the activity pointer is in nib and your code is not connected.

You can find it here with screenshots of how to do it.

https://developer.apple.com/library/ios/#documentation/IDEs/Ccept

+1
source

Instead of the string "@property" instead of "weak" should use "strong".

UIActivityIndicatorView is freed directly if weak is used and you do not want it.

You might also need to set a frame in the view.

0
source

All Articles