开发者

UIViewController and UIScrollView

I have a custom UIViewController class whose view (hooked up in IB) is a UIScrollView. I want to know when the UIScrollV开发者_开发技巧iew gets "touch up inside".

I overrode the

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

method but it doesn't get called. What am I doing wrong?


Did you override touchesBegan:: in the UIViewController or the UIScrollView? If you did it on the UIViewController, it needs to be in the UIScrollView (or whatever it contains).

The UIScrollView is intercepting the touch events before it "bubbles" to your UIViewController.


like ryan said, you need to override your touchesBegan:: method in the UIScrollView. you may need to create a custom scrollView for this purpose and set the scrollView you use (in IB) to that class. also, be sure to set the scrollView delegate to your view controller. that way, when touches are intercepted, it knows where to send them

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜