Search code examples
cocoa-touchtoolbartap

Hide/show toolbar on tap


Because I have an wallpaper app , I want that wehen you open the app there is no toolbar and that when you tap on the screen the toolbar comes , tap again and it goes away. How to do that ?


Solution

  • You can adjust the toolbar's alpha value like so:

    To Hide:

    toolbar.alpha = 0.0;
    

    To Show:

     toolbar.alpha = 1.0;
    

    Example:

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    // self.navigationController.toolbar.alpha = 0.0;
    // or
    // toolbar.alpha = 0.0;
    [UIView commitAnimations];