質問

I am not sure why, but for some reason my UIActivityIndicator spinner stays visible for awhile after I ask it to stop spinning. In my app, I check for updates with a block method callback when the check is complete after which point the activity indicator is to be hidden. The NSLog is processed immediately when the block is called, but it takes maybe 5-10 seconds for the indicator to disappear. Nothing is going on in the main as far as I can tell, the app is just sitting there. I am very confused...

    [self showActivityIndicator];
    [[self schedulePack] checkForUpdates:^(void)
     {
         NSLog(@"Done updating.");
         [self hideActivityIndicator];
     }];
役に立ちましたか?

解決

The problem is probably that you access a UI element from a separate thread. Try replacing
[self hideActivityIndicator];
with
[self performSelectorOnMainThread:@selector(hideActivityIndicator) withObject:nil waitUntilDone:NO];

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top