iphoneuiscrollviewhittestcustom-paging

Can't override "hitTest" method for UIScrollView


I've created a scroll view, width less than the screen width and set clipsToBounds=YES. As the UIScrollView doesn't scroll from anywhere outside the range of its frame, I put the UIScrollview inside a UIView and tried to override the "(UIView *)hitTest:WithEvent:" method. But it always shows warning pointInside method not found (or something like that) in the if ([self pointInside:point withEvent:event]) line and it doesn't work. What did I do wrong? Thanks in advance...


Solution

  • Answering my own question, the problem is I didn't create the UIVIew subclass to override the (UIView *)hitTest:WithEvent: while the UIScrollView was in a subview of self.view. So, it is important to check which view inherits the scroll view and write overridden method in the parent view class.