English 中文(简体)
Fade To Black when, Setine Down
原标题:Fade To Black When iPhone is Set Face Down

作为一个新的发展者,我从未使用过方向。 因此,我要尝试以简单的任务学习。 我想要做的是,当该装置被 down倒时,就会有黑色。 也许有些人可以帮助我,或提供有用的信息,这是否简单易行?

Thanks! :D Your help is appriciated

最佳回答

You can use orientation (using the XYZ values when the screen is face down). I do not recommend this, because your screen will fade out even if a user is using the app while lying down, and staring up at the screen.

比较容易和更清洁。 在电话中,把电话贴近你的耳光的黑人,如何通知?

可以通过监测<代码>proximityState Property of UIDevice,查阅该财产。 详情here

Doing something like:

BOOL closeToUser = [[UIDevice currentDevice] proximityState];

将指定一个<代码>YES,以关闭 装置在某种表面上被压倒的用户,以及<代码> NO 不适用

如果价值是YES,你可以援引代码来做你想要的一切。

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签