Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to get my first spinner to work, and I can't seem to get it to show up on the screen.

I tried dragging the UIActivityIndicatorView on the storyboard to my screen, but then when I tried to connect it to my header file via the storyboard, it didn't seem to respond. (what are the correct steps there?)

So I did it manually. I added this line to my .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, no spinner showed up. Any thoughts on what I am doing incorrectly here?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
189 views
Welcome To Ask or Share your Answers For Others

1 Answer

Select your spinner in your nib file right click -> click & drag from reference to files owner. Then select aSpinner.

It does not show up, because activityindicator in nib and your code are not connected.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...