我在数据库查询后使用此代码:
dispatch_async(dispatch_get_main_queue(), ^{
if (self.downlaodLabel) {
NSLog(@"label is not nill");
NSLog(@"text %@",self.downlaodLabel.text);
}
self.downlaodLabel.hidden = NO;
[self.downlaodLabel setAlpha:1];
[self.downlaodLabel setText:[NSString stringWithFormat:@"on the map there are %lu pictures",(unsigned long)[self.mapView.annotations count]]];
[self.activityIndicator stopAnimating];
[UIView animateWithDuration:0.5
delay:5.0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
[self.downlaodLabel setAlpha:0];
}
completion:^(BOOL fin){
if (fin) {
}
}];
});
我第一次调用此代码时,一切正常,实际上标签在屏幕上正确出现和消失,但第二次代码不起作用,屏幕上没有任何内容。我不明白出了什么问题,为什么第一次一切正常。谢谢大家。