如何根据界面指南在iPad / iPhone上使控件消失 [英] How to make controls fade away on iPad/iPhone as per interface guidelines
问题描述
HIG在iPad上发表声明,考虑逐渐淡出与内置照片应用程序相似的控件。
这是如何实现的?
在我的情况下,我有一个图像占据屏幕的大部分,带有标签栏和可能的工具栏以及可能的其他控件。除图像外,我如何淡化一切。如果用户触摸屏幕,请将其恢复。
THe HIG makes a statement that on the iPad, to consider fading away controls similar to how the built in photo app does it. How is this accomplished? In my case I have an image occupying the majority of the screen with a tab bar and potentially tool bar and potentially other controls. How do I fade everything away except the image. And bring it back if the user touches the screen.
谢谢
推荐答案
<我认为你有两种选择。首先,通过核心动画,您可以在大约0.5或1秒内将alpha设置为0,另一种方法是将工具栏和导航栏设置为隐藏。如果你正在使用导航控制器,你可以调用
I think you have 2 alternatives. First, by core animation, you can set the alpha to 0 in about 0.5 or 1 second, the other way is to set the toolbar and navigation bar to hidden. If you're working with a navigation controller, you can call
[self.navigationController setToolbarHidden:YES animated:YES];
或
[self.navigationController setNavigationBarHidden:YES animated:YES];
这可能做你想做的事。
如果用户触摸屏幕,请将其恢复。
"And bring it back if the user touches the screen."
为此,您可以实施以下方法:
For this, you may implement methods like:
– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesEnded:withEvent:
– touchesCancelled:withEvent:
如果您只处理UIViewController子类,这将有效。
this will work if you're working on a UIViewController subclass only.
这篇关于如何根据界面指南在iPad / iPhone上使控件消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!