grand central dispatch - iOS: UIActivityIndicator in navigation bar not stopping -
I wrote a small test app that does not work. This is my storyboard:
This is my code:
- (void) viewDidLoad {[super viewDidLoad]; UIActivityIndicatorView * AI = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleGray]; UIBarButtonItem * rightButton = [[UIBarButtonItem alloc] initWithCustomView: O]; Self.navigationItem.rightBarButtonItem = rightButton; [AI initialization]; dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^ {[NSThread sleepForTimeInterval: 5]; NSLog (@ "! Stop"); [stopAnimating AI];}); } This work result is:?
What is wrong
It went solved a similar problem:
[spinner start allowance]; dispatch_async (kBgQueue, ^ {// ... (dispatch_get_main_queue (), ^ {[spinner stopAnimating] other things in the background dispatch_async;});});
Comments
Post a Comment