iPhone UIActivityIndicatorView not starting or stopping

前端 未结 6 2294
囚心锁ツ
囚心锁ツ 2020-12-17 23:32

When I call startAnimating on a UIActivityIndicatorView, it doesn\'t start. Why is this?

[This is a blog-style self-answered question. The solution below works for

6条回答
  •  [愿得一人]
    2020-12-18 00:05

    This question is quite useful. But one thing that is missing in the answer post is , every thing that takes long time need to be perform in separate thread not the UIActivityIndicatorView. This way it won't stop responding to UI interface.

        - (void) doLotsOFWork:(id)data {
        //  do the work here.
    }
    
        -(void)doStuff{
        [activityIndicator startAnimating]; 
        [NSThread detachNewThreadSelector:@selector(doLotsOFWork:) toTarget:self withObject:nil]; 
        [activityIndicator stopAnimating];
    }
    

提交回复
热议问题