UIScrollView not responding to touch events

Discussion in 'iOS Programming' started by tonydleopard, Nov 21, 2008.

  1. tonydleopard macrumors newbie

    Nov 21, 2008

    I am a newbie to sdk. I am creating an app which has a custom navigation bar being put inside a scrollView. The navigation bar is generated by overriding the drawRect method of UIView class. The navigation bar has other items which are not part of the scroll view. Now the problem is the items inside the navigation bar which falls inside the scroll view is not responding to any of the touch events. The hierarchy of the app is as follows the mainView--> Navigation Strip(Which is a subclass of UIView)-->ScrollView inside the Navigation Strip.

    Thanks in advance,
  2. tonydleopard thread starter macrumors newbie

    Nov 21, 2008
    yeah the issue is solved.

    The solution is to subclass the UiScrollView and create the scrollview from this subclass. then implement the touchesBegan, touchesEnded methods inside the subclass and it will recognize the touches for you. Implementing the touchesmoved method may screw up you scroll view as scrolling maynot happen.

  3. fenrus110 macrumors regular

    Mar 24, 2008
    i had no problems implementing touchesBegan on my UIScrollView. maybe because I had stuff on top of it acting like a cover over top of it.

    If you want to implement touchesMoved, you should set scrollEnabled = NO; on touchesBegan, then re-enable it on touchesEnd.

Share This Page