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.

12500 questions
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,513
  • 49
  • 182
  • 323
68
votes
6 answers

Setting contentOffset programmatically triggers scrollViewDidScroll

I've got a a few UIScrollView on a page. You can scroll them independently or lock them together and scroll them as one. The problem occurs when they are locked. I use UIScrollViewDelegate and scrollViewDidScroll: to track movement. I query the…
DBD
  • 23,075
  • 12
  • 60
  • 84
67
votes
11 answers

Disable UIScrollView scrolling when UITextField becomes first responder

When a UITextField embedded in a UIScrollView becomes the first responder (for example, by the user typing in some character), the UIScrollView scrolls to that Field automatically. Is there any way to disable that? Duplicate rdar://16538222
Rabih
  • 671
  • 1
  • 5
  • 3
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,163
  • 3
  • 21
  • 23
66
votes
15 answers

UICollectionView Horizontal Paging not centered

I have a horizontal scrolling collectionView with each cell the size of the view. When I page through the collectionView it doesn't page by cell. The cells aren't in the center of the screen. I've tried a bunch of things to try to fix it and haven't…
mlevi
  • 1,433
  • 3
  • 18
  • 30
66
votes
8 answers

UIScrollView works as expected but scrollRectToVisible: does nothing

I have used UIScrollView before, and am using it now, and never had a problem. I'm now adding it to an old app, and while it works as expected (I can look at the contents, scroll around with my finger, all the bounds and sizes are setup right so…
mahboudz
  • 39,196
  • 16
  • 97
  • 124
64
votes
12 answers

Dismissing the keyboard in a UIScrollView

Alright, I have a couple of UITextFields and UITextViews inside a UIScrollView, and I'd like to set the keyboard to disappear whenever the scrollview is touched or scrolled (except when you touch down inside the text field/view, of course). My…
Nicholas1024
  • 880
  • 1
  • 9
  • 15
63
votes
8 answers

How to scroll UITableView to specific position

How can I scroll the table's cell to specific position ? I have a table which shows 3 rows (according to height). what I want is if I click on 1st row than according to table's height the 1st row should scroll and get new position (center) and same…
Maulik
  • 19,348
  • 14
  • 82
  • 137
63
votes
4 answers

How to enable zoom in UIScrollView

How do I enable zooming in a UIScrollView?
Ideveloper
  • 1,467
  • 4
  • 23
  • 44
63
votes
13 answers

calculating height of UITabBar

I'm writing an app that uses UITabBar for parts of the navigation. I'm also using UIScrollView for presenting more information than what the screen can typically handle. Because of this, I'm needing to set the scroll view to take into account the…
Matt Delves
  • 1,585
  • 2
  • 13
  • 19
62
votes
5 answers

UITableView within UIScrollView using autolayout

At the moment, I'm using a UITableView along with other views that are contained in a UIScrollView. I want the UITableView to have its height to be the same as its content height. To complicate things, I'm also inserting / deleting rows to provide…
Matt Delves
  • 1,585
  • 2
  • 13
  • 19
62
votes
15 answers

UIScrollView contentSize not working

I put a UIScrollView in my nib's view, and linked it to a an IBOutlet property. Now, when I do this in my viewDidLoad method, it seems to have no effect on the contentSize: self.sv.backgroundColor = [UIColor yellowColor]; // this works CGSize size =…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
61
votes
5 answers

UICollectionView effective drag and drop

I am currently trying to implement the UITableView reordering behavior using UICollectionView. Let's call a UItableView TV and a UICollectionView CV (to clarify the following explanation) I am basically trying to reproduce the drag&drop of the TV,…
foOg
  • 3,126
  • 3
  • 19
  • 18
59
votes
6 answers

How to create a centered UICollectionView like in Spotify's Player

I am have a lot of difficulty trying to create a UICollectionView like in Spotify's Player that acts like this: The problem for me is two fold. 1) How do I center the cells so that you can see the middle cell as well as the one of the left and…
58
votes
7 answers

UIButton touch is delayed when in UIScrollView

I'm running into a small issue in my app. I essentially have a series of UIButtons added as subviews in a UIScrollView which is part of a nib. Every time I tap on a button there is a noticeable delay before the button is highlighted. I essentially…
Jeff
  • 2,818
  • 3
  • 29
  • 31