Questions tagged [uiscrollview]

Use this tag for all questions about scroll views on iOS. Do NOT use this tag for other platforms.

UIScrollView is the native scroll view system in iOS. It is part of Cocoa and UIKit. A number of other very common iOS classes, such as UITableView, are based on UIScrollView. UIScrollViewDelegate is the associated delegate.

Full Apple documentation for UIScrollView is at the usual Apple documentation site. It is on the internet. It can be found at https://developer.apple.com/reference/uikit/uiscrollview.

Use this tag only for the specific, iOS, UIScrollView class. For the native scroll views in other specific platforms, such as Android, use those tags.

If you genuinely have a rare, non-platform-specific, general conceptual question about scroll views, you could use the otherwise totally worthless tag.

12334 questions
79
votes
10 answers

Detecting UIScrollView page change

Is there a way to detect or get a notification when user changes the page in a paging-enabled UIScrollView?
Pompair
  • 6,623
  • 11
  • 56
  • 68
79
votes
4 answers

UIScrollView doesn't use autolayout constraints

I have a scroll view and an image view behind it and I am populating it with nibs. I am using autolayout. I have a bottom space to superview and a top space to superview on both of the views. The image view does exactly what I want it to do. For…
SirRupertIII
  • 11,244
  • 19
  • 66
  • 113
77
votes
11 answers

Can I use a UIRefreshControl in a UIScrollView?

I have about 5 UIScrollView's already in my app which all load multiple .xib files. We now want to use a UIRefreshControl. They are built to be used with UITableViewControllers (per UIRefreshControl class reference). I do not want to re-do how…
SirRupertIII
  • 11,244
  • 19
  • 66
  • 113
74
votes
5 answers

Sizing a Container View with a controller of dynamic size inside a scrollview

I'm trying to create a container view, with a controller that has a dynamic height, inside a UIScrollView and have it sized automatically using auto layout. View Controller A is the scrollview, which has the container view included, along with more…
74
votes
24 answers

Keeping the contentOffset in a UICollectionView while rotating Interface Orientation

I'm trying to handle interface orientation changes in a UICollectionViewController. What I'm trying to achieve is, that I want to have the same contentOffset after an interface rotation. Meaning, that it should be changed corresponding to the ratio…
73
votes
3 answers

How can I get the UITableView scroll position so I can save it?

Is there any way to find out which UITableViewCell is at the top of the scroll window? I'd like to get the current scroll position so that I can save it when the app exits. When the app gets started I want to scroll to the position it was at when…
progrmr
  • 71,681
  • 16
  • 107
  • 147
73
votes
2 answers

UITextView content inset

I have encountered something a bit strange with contentInsets I have a UITextView in my storyboard with a contentInset of 50 left, as I'm trying to add some padding to my uitextview However, a scrollbar appears on the bottom of the uitextview, as…
H Bellamy
  • 20,906
  • 22
  • 68
  • 110
72
votes
4 answers

UIScrollview getting touch events

How can I detect touch points in my UIScrollView? The touches delegate methods are not working.
user559005
72
votes
16 answers

Snap to center of a cell when scrolling UICollectionView horizontally

I know some people have asked this question before but they were all about UITableViews or UIScrollViews and I couldn't get the accepted solution to work for me. What I would like is the snapping effect when scrolling through my UICollectionView…
Mark Bourke
  • 9,052
  • 7
  • 21
  • 29
71
votes
8 answers

Getting the visible rect of an UIScrollView's content

How can I go about finding out the rect (CGRect) of the content of a displayed view that is actually visible on screen. myScrollView.bounds The code above works when there's no zooming, but as soon as you allow zooming, it breaks at zoom scales…
Kenneth Ballenegger
  • 2,900
  • 2
  • 17
  • 25
69
votes
7 answers

why UIScrollView is leaving space from top in ios 6 and ios 7

I have turned off Autolayout and viewcontroller is embedded in navigation controller. I am using Xcode 5, Storyboard. I don't understand why is it leaving space from top. Actually in storyboard i have put my label exactly below navigation bar. But…
bhavya kothari
  • 7,471
  • 4
  • 25
  • 53
69
votes
7 answers

iOS 7 -- navigationController is setting the contentInset and ContentOffset of my UIScrollView

I have a UIScrollView (actually a UICollectionView, but that probably doesn't matter). When it appears in IOS 7, the navigation controller sets its contentInset and contentOffset to values I don't want. It appears to be trying to adjust for the…
William Jockusch
  • 26,421
  • 48
  • 170
  • 299
67
votes
9 answers

How to fix "Scrollable Content Size Ambiguity" in Xcode 11 (iOS 12, iOS 13) using Auto Layout

When using Auto Layout, I am unable to set up a simple UIScrollView in my view controller in Xcode 11 beta. I know that I must constrain the scroll view to the edges, and then set the scroll view width and height equal to the width and height of the…
Pranav Ramesh
  • 690
  • 1
  • 3
  • 8
66
votes
18 answers

Keep uitableview static when inserting rows at the top

I have a tableView that I'm inserting rows into at the top. Whilst I'm doing this I want the current view to stay completely still, so the rows only appear if you scroll back up. I've tried saving the current position of the underlying UIScrollview…
Dean Smith
  • 2,103
  • 3
  • 20
  • 23
65
votes
11 answers

Disable UIScrollView scrolling when UITextField becomes first responder

When a UITextField, embedded in a UIScrollView becomes first responder, by lets say the user typing in some character, the UIScrollView scrolls to that Field automatically, is there any way to disable that? Duplicate rdar://16538222 over
Rabih
  • 651
  • 1
  • 5
  • 3