如何根据界面指南在iPad / iPhone上使控件消失 [英] How to make controls fade away on iPad/iPhone as per interface guidelines

查看:147
本文介绍了如何根据界面指南在iPad / iPhone上使控件消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆