iPhone sdk Cocoa Touch - Pass touches down from parent UIView to child UIScrollview

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2009-12-15T13:01:53Z Indexed on 2012/10/03 3:38 UTC
Read the original article Hit count: 459

I have a UIView inside my xib in IB and inside that is a UIScrollview that is a small 80x80 square and dynamically loaded with 8 or so 80 x 80 thumbnail images.

The UIScrollview is not clipping the images so that they extend out either side so you can swipe left and right to scroll a chosen image into the the centre, paging is on so they snap ti each image.

I have researched and found this is the best and possibly only way to do this.

The UIScrollview sits in a 'container' UIView for one reason, it is there to receive the touches/swipes and pass them down to it's child the UIScrollview as otherwise all touches would have to start in the small 80x80 UIScrollview area and I wan them to be anywhere along the row of images.

I have seen some sample code somewhere for doing this but just can not implement it.

Treat me as a noob, starting from beginning to end, how should the UIView and UIScrollview be set up in IB to allow any touches to be passed, and what code should I put into where?

The UIView is set up as scroll_container and the child UIScrollview is char_scroll

At the moment I have got it all working except for the touches being passed from the parent to the child, and at the moment the touches have to always start inside the UIScrollview (tiny 80x80 box in centre) when I want to be able to swipe left or right in the long 480X80 horizontal parent UIView and have this still scroll the child UIScrollview.

Hope you can help and understand what I mean!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch