[英]Show/Hide Toolbars in iPhone app on user touch
How can I make the main content view of my app full screen, and show the toolbar only when the user touches the screen and one more touch will hide the toolbar? 如何使应用程序的主要内容视图全屏显示,并且仅在用户触摸屏幕时显示工具栏,再触摸一次就会隐藏工具栏? kind of like the ibooks app?
有点像ibooks应用?
also how do I make a toolbar transparent? 还如何使工具栏透明?
To make content view of your app full screen just set [[UIApplication sharedApplication] setStatusBarHidden:YES];
要使您的应用程序的内容视图全屏显示,只需设置
[[UIApplication sharedApplication] setStatusBarHidden:YES];
To hide/show : Identify the tap area of status bar when clicked set - [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
隐藏/显示:单击时确定状态栏的点击区域set-
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
. 。
To make it transparent use [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
要使其透明,请使用
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
Out of interest, are you using a UIWebView
? 出于兴趣,您正在使用
UIWebView
吗? Because that makes life more tricky, because you need to detect tap views to the UIWebView
. 因为这会使生活变得更加棘手,因为您需要检测
UIWebView
点击视图。 There are four main ways of doing this. 有四种主要方法可以做到这一点。
UIWebView
. UIWebView
。 Not recommended because Apple tell you not to do this. UIWindow
. UIWindow
。 I found this to work very well - until I needed to rotate to landscape, which it wouldn't let me do! UIView
on top of the UIWebView
, but I think this also involves subclassing and is not recommended. UIView
放在UIWebView
之上的东西,但是我认为这也涉及子类化,因此不建议这样做。 I have never tried this. UIWebView
(through changing document.location
in the javascript, then intercepting the URL request through the Objective-C code, denying access, and using it to do the things which Chandan Shetty SP suggests above. UIWebView
(通过更改javascript中的document.location
,然后通过Objective-C代码拦截URL请求,拒绝访问,并使用它来完成Chandan Shetty的工作SP以上建议。 However, if you are not using a UIWebView
, this post is irrelevant. 但是,如果您不使用
UIWebView
,则此帖子无关紧要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.