Touches going through tabbar to table view underneath

Hopefully someone can help me.

I have a tabbar which toggles between 5 scenes, all of which contain a tableview. My “onPress” method for the tabbar returns true, which I would’ve thought would be enough to stop touch events being applied to objects underneath it…but they still are.

It’s very annoying for the user because they change to a new tab, and immediately click a table view cell even though they didn’t click on a visible part of the table cell.

I find that I have a similar problem if I have two objects with one using a “touch” event and one using a “tap” event, if the user performs one of these events the ‘return true’ doesn’t always prevent user input on the second event.

I imagine that if I was using a mask on the table view so that it could not exist beneath the tabbar this may help. However I find that if I use an image that covers most of the screen (let’s say 868x648 including the padding needed), that this is not suitable for devices with a different aspect ratio. If I use this mask on an HTC Sensation which has a taller screen than an iPhone 4, I end up with a tableview which does not touch the top of the screen and the top of the tabbar.

I imagine the 2 problems are related somehow, but I’m just not sure how to fix it so would be grateful for any help. [import]uid: 84115 topic_id: 31143 reply_id: 331143[/import]

I’ve got a similar problem with two screens in my app as well.

Though in my case, the first screen is a tableview, and the second isn’t. I am listening for touches on the tableview, and taps on the second screen…

After reading through your issues, I think I might be able to fix my code now (that I understand the problem there)… It might be similar events in your case…

In my case, I think it’s because my first screen, the tableview, takes touch events, it’s called on the “begin” phase. In that phase I immediately launch the second screen, which covers the display.

The user then lifts their finger and most likely a touch event is generated in the end phase.

And THEN a tap event is generated (finger up just finished, it couldn’t do a tap event until then ya know) – which now falls to my NEW screen I just put up (all from one finger touch/release).

So, for a finger down and up on the display, at least three events can be generated. The touch begin and end, and a separate tap event, which occurs after the touch events (I am guessing on that last part, it could be done immediately before the touch end event, but I would doubt it).

Whew. Now that I think about it, that’s all pretty obvious isn’t it? (hehehe)

EDIT: Note that your return of true DOES stop the event from propagating… the event is for the touch BEGIN phase, and if you return true, then the touch begin phase stops being passed around. This in no way affects the touch end phase event, which is a totally separate event. Same goes for the tap. Each much return true to stop itself from being passed around. [import]uid: 79933 topic_id: 31143 reply_id: 124579[/import]

I’m still not 100% sure.

I rarely let my touch events trigger on the “began” phase, always “ended”, and the tabbar “onPress” function doesn’t seem to have any phase type at all (printing event.phase showed as nil) so there doesn’t seem to be a way of preventing propagation of the touch through it if the next object uses a tap event.

I’ve changed the tableview cell to use a touch instead of tap which has fixed this problem but it has caused another one.

For some reason now, the “ended” phase ONLY triggers if the “moved” phase has also occurred. If I simply touch and let go only the “began” phases registers, regardless of how short/long the touch is for. If I touch the cell, move my finger any distance and then release, the end phase will trigger. I suspect the table view scrolling functionality is causing the problem.

I stopped using the “onEvent=onRowTouch” function for the table view, because the “release” phase was unreliable. I had to press the row 3 or 4 times before it would register sometimes, other times it would work straight away. Instead I have placed a rect into the row, which is exactly the same size and has a regular touch event.

Have you had any issues with the touch events not working reliably on your tableview? [import]uid: 84115 topic_id: 31143 reply_id: 124669[/import]

I’ve got a similar problem with two screens in my app as well.

Though in my case, the first screen is a tableview, and the second isn’t. I am listening for touches on the tableview, and taps on the second screen…

After reading through your issues, I think I might be able to fix my code now (that I understand the problem there)… It might be similar events in your case…

In my case, I think it’s because my first screen, the tableview, takes touch events, it’s called on the “begin” phase. In that phase I immediately launch the second screen, which covers the display.

The user then lifts their finger and most likely a touch event is generated in the end phase.

And THEN a tap event is generated (finger up just finished, it couldn’t do a tap event until then ya know) – which now falls to my NEW screen I just put up (all from one finger touch/release).

So, for a finger down and up on the display, at least three events can be generated. The touch begin and end, and a separate tap event, which occurs after the touch events (I am guessing on that last part, it could be done immediately before the touch end event, but I would doubt it).

Whew. Now that I think about it, that’s all pretty obvious isn’t it? (hehehe)

EDIT: Note that your return of true DOES stop the event from propagating… the event is for the touch BEGIN phase, and if you return true, then the touch begin phase stops being passed around. This in no way affects the touch end phase event, which is a totally separate event. Same goes for the tap. Each much return true to stop itself from being passed around. [import]uid: 79933 topic_id: 31143 reply_id: 124579[/import]

I’m still not 100% sure.

I rarely let my touch events trigger on the “began” phase, always “ended”, and the tabbar “onPress” function doesn’t seem to have any phase type at all (printing event.phase showed as nil) so there doesn’t seem to be a way of preventing propagation of the touch through it if the next object uses a tap event.

I’ve changed the tableview cell to use a touch instead of tap which has fixed this problem but it has caused another one.

For some reason now, the “ended” phase ONLY triggers if the “moved” phase has also occurred. If I simply touch and let go only the “began” phases registers, regardless of how short/long the touch is for. If I touch the cell, move my finger any distance and then release, the end phase will trigger. I suspect the table view scrolling functionality is causing the problem.

I stopped using the “onEvent=onRowTouch” function for the table view, because the “release” phase was unreliable. I had to press the row 3 or 4 times before it would register sometimes, other times it would work straight away. Instead I have placed a rect into the row, which is exactly the same size and has a regular touch event.

Have you had any issues with the touch events not working reliably on your tableview? [import]uid: 84115 topic_id: 31143 reply_id: 124669[/import]

I have the same problem with you, can teach me how to combine tableview with tab bar, mine cannot work…very grateful for helping me. [import]uid: 178893 topic_id: 31143 reply_id: 125240[/import]

@alan - No major issues for me. But my tableviews occasionally don’t seem to register scroll movements (and on the next swipe, it works). I’m not using tabs or other widgets that overlap then in any way though (mostly pretty simple stuff).

Maybe if you plumb xias’s issues with him, you’ll discover something that affects your code as well. [import]uid: 79933 topic_id: 31143 reply_id: 125259[/import]

I have the same problem with you, can teach me how to combine tableview with tab bar, mine cannot work…very grateful for helping me. [import]uid: 178893 topic_id: 31143 reply_id: 125240[/import]

@alan - No major issues for me. But my tableviews occasionally don’t seem to register scroll movements (and on the next swipe, it works). I’m not using tabs or other widgets that overlap then in any way though (mostly pretty simple stuff).

Maybe if you plumb xias’s issues with him, you’ll discover something that affects your code as well. [import]uid: 79933 topic_id: 31143 reply_id: 125259[/import]