Search code examples
iosxcode4.2uitoolbarios5.1

Toolbar sethidden=TRUE, sethidden=FALSE


I want to hide my toolbar if I click on a button, but it doesn't seem to work. I can hide the toolbar with an animation but I can't let it show up again. Thanks!

- (IBAction)hideTheToolBar{
    //[toolBar setHidden:YES];
    if (toolbar.hidden == NO)
    {
        [UIView animateWithDuration:0.25 delay:0.0
                            options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction
                         animations:^(void)
         {
             toolbar.alpha = 0.0f;
         }
                         completion:^(BOOL finished)
         {
             toolbar.hidden = YES;
         }
         ];
    }
    if (toolbar.hidden == YES) {
        toolbar.hidden = NO;
    }
}

Solution

  • i think u are missing a statement in the second if loop try:

     if (toolbar.hidden == YES) {
        toolbar.hidden = NO;
        toolbar.alpha = 1.0f ;
    }