How to enable touch events pass through UIView?

I wonder if is possible to let touch events pass through the main UIView so I can interact with OF directly, at the moment when my GUI view is visible touch events in testApp are not register, any ideas how to work around this?

Thanks

Just add the main UIView to [ofxiPhoneGetGLView() addSubview: myview.view]; instead of the ofxiPhoneGetGUIView (or whatever the other call is).

The key is to add it to “ofxiPhoneGetGLView()”. Touches will pass through the transparent elements of the GUI to the opengl.

1 Like

Hi Seth,
Like you suggested

  
[ofxiPhoneGetGLView() addSubview: myview.view];  

is how I add the view but still no touches passing through

Hmm, i’ll have to check in a bit when I’m back on my OSX computer.

There’s a couple related posts here:

http://forum.openframeworks.cc/t/detecting-multitouch-on-a-uiview-overlaid-on-the-of-view/4196/0
http://forum.openframeworks.cc/t/capture-touch-events-in-multiple-views/2544/0

My bad I was using ofxiPhoneGetUIWindow instead, apply the change but the problem persist, strangely if I double tap rapidly I can pass some touches through to OF… same happens on iPodTouch and iPad, I am using 007 by the way.

I have another problem using ofxiPhoneGetGLView, the willAnimateRotationToInterfaceOrientation method is not trigger at launch, but until a 180 rotation of the device happens, if that method is not trigger at launch my menu view scale and position itself for portrait orientation, even if the app launches in landscape, any ideas how can I solve this using ofxiPhoneGetGLView?

I think I am going to follow Theo suggestion from one of your previous links

One thing you can do - if say your gui is just a nav bar or something and you want the rest of the space to be OF with touch is to make the gui view the size of just the nav element in project builder and then position it in the right place in viewDidLoad . All touches that aren’t in the nav bar area will pass through to OF.

Thanks Seth!

For some bizarre reason I had the main UIView class set to UIControl, change it back to UIView and now the touches pass through using ofxiPhoneGetGLView()

Thanks again

Awesome! I’m glad you got that part working. :slight_smile: