开发者

Hide/show toolbar on tap

开发者 https://www.devze.com 2023-02-16 15:39 出处:网络
Because I have an wallpaper app , I want that wehen you op开发者_JS百科en 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

Because I have an wallpaper app , I want that wehen you op开发者_JS百科en 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 ?


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];


In the uiimageview of your wallpaper add a method call touchesEnded: this will be called when you have touched the imaheView. The set hide the toolbat [toolbar setHidden:Yes animated:Yes];

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号