PDA

View Full Version : UIScrollView not responding to touch events




tonydleopard
Nov 21, 2008, 05:42 AM
Hi,

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,
Tony



tonydleopard
Nov 24, 2008, 05:13 AM
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.

Thanks,
Tony

fenrus110
Nov 24, 2008, 11:18 AM
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.