UIView strange behaviour

Discussion in 'iOS Programming' started by namanhams, Jun 3, 2009.

  1. namanhams macrumors regular

    Jun 3, 2009
    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.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    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.
  3. namanhams thread starter macrumors regular

    Jun 3, 2009

    Thanks for the reply. I'll read about it, but after i change from UIView to UIControl, it works perfectly.

Share This Page