Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 895775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:36:49+00:00 2026-05-15T14:36:49+00:00

The too long; didn’t read version: Is there any way to disable the automatic

  • 0

The “too long; didn’t read” version: Is there any way to disable the automatic scrolling behaviour of UIScrollView when telling a UITextField to becomeFirstResponder?

I have a scroll view with paging enabled and several views as subviews, each subview being controlled by its own view controller. Each subview has a UITextField.

The requirement is that when a page is scrolled into view, it’s text field should become first responder.

This is fine when using finger swipes to scroll — I use the scroll view delegate method scrollViewDidEndDecelerating: to know when scrolling stops and a page is in view, I can tell the text field to become first responder.

However, when the scroll view is “autoscrolled”, as in when telling the scrollview to scrollRectToVisible:animated:, the scroll view delegate method for deceleration isn’t called. I use this method when scrolling newly created pages into view without the user’s interation, or when the user taps the UIPageControl.

My solution was to simply set the first responder status of the text field before telling it to scroll into view – but it seems that telling a text field that is in a scroll view to become first responder causes the scroll view to automatically scroll it into view.

I assume this is behaviour used when putting text fields in table view cells (since table views are scroll view subclasses). If you set up a small test app, with a table view, and a text field within a table cell, if the keyboard would obscure the table view cell when it becomes first responder, the table view will automatically scroll it to be visible.

I don’t understand, though, why this behaviour occurs in my example, where I’m not using a table view – just a plain scroll view.

I should also mention that my scroll view has vertical scrolling disabled and only scrolls horizontally.

I have tested in another test app that puts text fields as direct subviews of a scrollview (no view controllers or container views) and the same happens. If you tell a text field that is offscreen to become first responder, the scroll view with automatically scroll it for you.

This wouldn’t normally be a problem, but it seems to screw up the paging of the scroll view. When I scroll with my finger, each view bounces and is centred properly. But when I scroll a rect to be visible with animation and tell a text field to become first responder, scroll view seems to become conflicted with itself and the view is only scrolled part of the way into view, and isn’t centred.

Then, if I touch a view using my finger (not swipe, or even move), the scroll view jumps back to the first page.

My current work around for all this silly auto scrolling behaviour is to use an NSTimer to determine when to update the first responder.

I do the manual scrolling in code using scrollRectToVisible:animated and then after 0.3 seconds, call my method to update the text field to be first responder. (0.3 seconds was trial and error, trying to see which seemed to be the smallest amount of time to allow for the animation but still be long enough not to cause the conflict with the scrollview.

As you can see, this isn’t elegant, and is likely to break.

Is there any way to disable the automatic scrolling behaviour of UIScrollView when telling a UITextField to becomeFirstResponder?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:36:50+00:00Added an answer on May 15, 2026 at 2:36 pm

    Not an answer to your question, but it should fix the problem:

    - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
    {
      // Make the text field first responder...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since I got TLDR (too long didn't read) comments, I stripped 90% of this
Given a string that isn't too long, what is the best way to read
I just spent way too long trying to diagnose why, in the following snippet
The code for this question is too long to be of any use. But
I have now used way too long time, trying to figure out a problem,
I didn't want to make the title too long but this question specifically refers
I was asked this question not too long ago, and didn't have a good
It would take too long to explain why I need this, but I was
Been at this far too long; trying to populate a field in a record
My server database took too long to run two sql queries by separate thread.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.