I got a UIButton which makes the UIToolbar show and hide.
- (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");
}
}
The problem is that when i try to hide the toolBar,it works fine. But when i try to show it again, it won’t show up.
Any ideas?
When you animate the showing of the toolbar you have to set the alpha to
1.0fin theanimationsblock.Below is the correct code; I’ve marked the line that I changed with a comment.