Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

namanhams

macrumors regular
Original poster
Jun 3, 2009
153
0
Hi everyone,

I've a strange problem with the UIView.
Firstly, i've a UIScrollView, then i add 2 custom controls to the scroll view : one is the subclass of UIView, other is the subclass of UITextField.

In both controls, i implement the touch event handlers, so that when the user touch the control and move the finger, the control is moved accordingly. (Very simple idea).

Everything is fine when the scroll view is fit within the screen. But when i zoom out to make the scroll view bigger than the screen, then the control which is subclass of UIView doesn't recognize the "move" event anymore. When i touch, it recognize, but when i move, then the event is handled by the scroll view. For the class which is subclass of UITextField, everything works perfectly.

It seems that subclass of UITextField, UIButton,... works, but not UIView.


Does anyone have any idea ? Thanks a lot.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I don't know the full answer but UIScrollView has some special handling for UIControl subclasses. There's some mention of this in the UIScrollView header file. Your UIView subclass isn't a UIControl and the UITextField is.
 

namanhams

macrumors regular
Original poster
Jun 3, 2009
153
0
Hi,

Thanks for the reply. I'll read about it, but after i change from UIView to UIControl, it works perfectly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.