ios - iPhone : Can I programmatically disable auto turning off the display?

标签 ios objective-c cocoa-touch

我最近开始使用 Objective-C 开发 iPhone 应用程序,并组装了一个小型通用视频播放器,可以让我在 iPhone 上观看电视节目、电影等。除了一件小事外,一切都完美无缺。

如果我在这段时间内没有点击屏幕,显示屏总是会在一两分钟后关闭并变黑。

我想知道是否可以在我的应用程序打开时以编程方式保持显示。不过,我已经尝试将 idleTimerDisabled 设置为 true,但没有成功。

如果它有所作为,我的设备就已经越狱了,我也愿意接受仅适用于越狱设备的解决方案(如果有针对这种情况的任何解决方案)。

最佳答案

在 AppDelegate 中添加:

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions...

//Add this to your method
[UIApplication sharedApplication].idleTimerDisabled = YES;

关于ios - iPhone : Can I programmatically disable auto turning off the display?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15691813/

相关文章:

objective-c - 不断检查当前时间

iphone - MFMailComposeViewController : how do I embed a clickable URL link into the email message body

ios - NSRegularExpression,指定区分大小写匹配?

ios - 我试图在滚动页面时更改 ImageView 高度

ios - TableView NSInternalInconsistencyException

objective-c - 我怎样才能弃用整个协议(protocol)?

ios - 无法访问容器 View 的 tableview Controller 元素

ios - Google Places iOS : How to provide context to API for relevant local results

ios - QuickBlox IOS session 过期续订

objective-c - 继承的属性不起作用