Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Disabling UIScrollView autoscroll

michig54michig54 Posts: 7New Users Noob
edited February 2012 in iOS SDK Development
I haven't yet found a solution to this. I have several UITextFields on a UIScrollView. These UITextFields are not editable. But when I change the text of the UITextField, the UIScrollView automatically scrolls the UITextField into view. This is really annoying, I want the scroll view to stay right where it is at. I tried disabling scrolling, but this only disables manual user scrolling and auto scrolling still occurs. How can I stop autoscrolling?
Post edited by michig54 on

Replies

  • TouchmintTouchmint Tempe, AZPosts: 814Registered Users @ @ @
    edited December 2011
    michig54 wrote: »
    I haven't yet found a solution to this. I have several UITextFields on a UIScrollView. These UITextFields are not editable. But when I change the text of the UITextField, the UIScrollView automatically scrolls the UITextField into view. This is really annoying, I want the scroll view to stay right where it is at. I tried disabling scrolling, but this only disables manual user scrolling and auto scrolling still occurs. How can I stop autoscrolling?

    I would really be interested in the answer to this question too! thanks!
  • DomeleDomele Posts: 2,991Registered Users @ @ @ @ @
    edited December 2011
    A StackOverFlow answers says to try and turn off paging.
    If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.<br />
    <br />
    New app - See screenshots and details at <a href="http://www.globaclock.com"; target="_blank">www.globaclock.com</a>.<br />
    <br />
    If you want to
  • michig54michig54 Posts: 7New Users Noob
    edited December 2011
    I tried enabling and disabling paging, this still occurs.
  • michig54michig54 Posts: 7New Users Noob
    edited February 2012
    Finally figured out a solution to this! Just create a subclass of UIScrollView and implement the scrollRectToVisible:animated: method and just dont do anything. This does exactly what I need. I haven't seen any drawbacks to this yet. I don't use this function at all and don't plan on it. But I am sure if you were wanted to, you can do something more clever here. But this simple solution works for me.
    @interface NoAutoScrollUIScrollView : UIScrollView
    
    @end
    
    @implementation NoAutoScrollUIScrollView
    
    - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated
    {
    	// Don'd do anything here to prevent autoscrolling. 
    	// Unless you plan on using this method in another fashion.
    }
    
    @end
    
Sign In or Register to comment.