我有一个 UIButton,它使 UIToolbar 显示和隐藏。
- (IBAction)showHideToolbar:(id)sender{
if (toolBar.hidden == NO) {
[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^(void){toolBar.alpha =0.0f;}completion:^(BOOL finished){
toolBar.hidden = YES;}];
NSLog(@"hides");
}
else
if (toolBar.hidden == YES) {
[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationCurveEaseIn | UIViewAnimationOptionAllowUserInteraction animations:^(void){toolBar.alpha =0.0f;}completion:^(BOOL finished){
toolBar.hidden = NO;
}];
NSLog(@"show");
}
}
问题是当我尝试隐藏工具栏时,它工作正常。但是当我再次尝试显示它时,它不会出现。有任何想法吗?