如何在iPhone应用程序的隐藏状态栏区域中获取触摸事件? [英] How Can I Get Touch Events in an iPhone App's Hidden Status Bar's Area?

查看:98
本文介绍了如何在iPhone应用程序的隐藏状态栏区域中获取触摸事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个隐藏状态栏的iPhone应用程序。但是,当我点击状态栏区域时,我的主视图没有任何触摸事件。我可以做些什么来解决这个问题吗?

I have an iPhone app that hides the status bar. However, my main view doesn't get any touch events when I tap in the status bar area. Is there something I can do to fix this?

以下是我的应用程序设置的一些细节(如果重要的话):

Here are a few details of my app's setup (in case it matters):


  • 这是一个基于OpenGL的应用程序。

  • 应用程序以横向模式启动。但是,当我点击纵向模式区域顶部附近的区域时,触摸事件丢失。 (换句话说,当我将设备保持横向时,我不会在左边缘触摸事件。)

  • 我的info.plist将UIStatusBarHidden设置为true,并在我的application delegate的applicationDidFinishLaunching方法我有application.statusBarHidden = YES;

  • 主视图的exclusiveTouch设置为YES。

  • 视图的touchesBegan:withEvent当我点击屏幕上的任何其他位置时调用方法。

  • 我的视图在状态栏区域内正常显示。

  • It's an OpenGL-based application.
  • The app launches in landscape mode. However, the touch events are missing when I tap in the area near the "top" of the portrait-mode area. (In other words, I don't get touch events on the left edge when I have the device held in landscape orientation.)
  • My info.plist has UIStatusBarHidden set true, and in my application delegate's applicationDidFinishLaunching method I have "application.statusBarHidden = YES;"
  • The main view has exclusiveTouch set to YES.
  • The view's touchesBegan:withEvent method is called when I tap anywhere else on the screen.
  • My view draws fine within the status-bar area.

(请不要抱怨NDA。谢谢。)

(Please refrain from whining about the NDA. Thank you.)

更新:事实证明,这个问题只能在iPhone模拟器上体现出来。当应用程序在实际的iPhone上运行时,到处都会检测到触摸。

Update: It turns out that this problem only manifests itself on the iPhone Simulator. When the app is run on an actual iPhone, touches are detected everywhere.

我仍然有兴趣知道是否有办法让它在模拟器上运行,但这没什么大不了的。

I'm still interested to know if there is a way to make it work on the Simulator, but it's no big deal.

推荐答案

找到我自己的答案(种类):

Found my own answer (of sorts):

此行为仅发生在iPhone模拟器中。当我在一个真正的iPhone上运行该应用程序时,它工作正常。

This behavior only happens in the iPhone Simulator. When I run the application on an actual iPhone, it works fine.

我仍然有兴趣知道是否有办法让它在模拟器上运行。

I'd still be interested to know if there is a way to make it work on the simulator.

这篇关于如何在iPhone应用程序的隐藏状态栏区域中获取触摸事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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