我在数据库查询后使用此代码:
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) {
}
}];
});
第一次调用此代码时,一切正常,事实上标签正确显示并在屏幕上消失,但第二次代码无效,屏幕上没有任何内容。我无法理解什么是错的,为什么第一次一切正常。 谢谢大家。
答案 0 :(得分:0)
我认为如果删除UIViewAnimationOptionBeginFromCurrentState选项并使用0值,一切都会按预期工作。
[UIView animateWithDuration:0.5
delay:0.0
options:0
animations:^{
[self.downlaodLabel setAlpha:0];
}
completion:^(BOOL fin){
if (fin) {
}
}];