views:

84

answers:

1

Hello, I am new in iPhone programming. At the moment I am trying to recognize a constant touch. For example I want the user to leave his finger on the screen for the whole application.

I use a navigationcontroller which holds the different views. If the user now touches the screen in view1 and then the view is changed to view2 by pushing it on the stack (with pushviewcontroller) with still touching the screen then there are no touch events recognized by view2. If the user then releases his finger (no touch event) and touches the screen again then all events are recognized. Is this a bug or am I doing something totally wrong?

I haven't found any answer on this. Could someone help me?

A: 

This is expected behaviour. Touches are handled on a per-view basis.

Without overlaying a transparent view to handle touches, you can't change views using a navigation controller.

If you do overlay a transparent view to handle touches then no other views below that will receive touch events unless you propagate them through using some convoluted process.

Jasarien
Ok, thanks a lot for the very fast answer. I've tried it out but the value of alpha has to be at least 0.02 that the touch is being recognized, right? Or is it possible to make a really transparent view?
Milu
You can set the view's background color to `[UIColor clearColor]` and set the view's `opaque` property to `NO`. This will give the appearence of a completely transparent view, but still have the alpha set to 1.0 to preserve touches.
Jasarien
Great! Thanks for your help!
Milu