How to make UIScrollView respond to touch?

Discussion in 'iOS Programming' started by sujithkrishnan, Jun 19, 2008.

  1. sujithkrishnan macrumors 6502

    May 9, 2008
    Hi all.

    In my iPhone app, i am having a class inheriting UIView, and i implemented

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

    I added some labels and imageview to that class and the method is getting fired wherever i touch in the view. I added a SrollView to that view and when i touch the scroll view and contents inside it, the method is not firing.
    Moreover its a delegate method...

    remember the scrollview is subview of main view, which is having the above delegate method implemented.....

    Why so???

    Is Scrollview is different from other views???

    How to recognize a touch in scrollview or its content views???

    I went thru a method

    "- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view; // default returns YES

    for scrollview, but its a instance method, how to implement it to return true??

    Or i want to add views inside scrollview instead of scrollview inside view

    The main criteria is that i want to make a image in my view zoomable.

  2. wuf810 Guest

    Did you manage to get this working? I too cannot get

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

    to work. Anyone any idea how to implement this?

    Thanks, M.


Share This Page