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
140
votes
25 answers

How to automatically size UIScrollView to fit the content

Is there a way to make a UIScrollView auto-adjust to the height (or width) of the content it's scrolling? Something like: [scrollView setContentSize:(CGSizeMake(320, content.height))];
jwerre
  • 9,179
  • 9
  • 60
  • 69
136
votes
27 answers

UIScrollView not scrolling

I have a UIScrollView which contains many UIImageViews, UILabels, etc... the labels are much longer that the UIScrollView, but when I run the app, I cannot click and scroll down... Why might this be? Thanks
Mark
  • 14,820
  • 17
  • 99
  • 159
131
votes
17 answers

How to use UIScrollView in Storyboard

I have a scroll view with content that is 1000px tall and would like to be able to lay it out for easy design on the storyboard. I know it can be done programmatically but I really want to be able to see it visually. Every time I put a scroll view…
Alex Reynolds
  • 6,264
  • 4
  • 26
  • 42
102
votes
15 answers

How to disable horizontal scrolling of UIScrollView?

I have a UIView like iPhone's Springboard. I have created it using a UIScrollView and UIButtons. I want to disable horizontal scrolling on said scrollview. I want only vertical scrolling. How do I accomplish this?
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256
100
votes
14 answers

Getting the current page

In my scroll view, I want to get the current page that's being displayed (maybe page isn't the correct term). I can't find any variable that holds this. But I think it must be held somewhere, since the indicator is able to show which sub-view of the…
user440096
95
votes
18 answers

how do I use UIScrollView in Interface Builder?

While I've used UIScrollView successfully in the past by manipulating it programmatically, I'm having trouble getting it to work by setting it up exclusively in Interface Builder. I have a simple "about" page in my iPhone app. It has a…
George Armhold
  • 30,824
  • 50
  • 153
  • 232
91
votes
21 answers

UIScrollView: paging horizontally, scrolling vertically?

How can I force a UIScrollView in which paging and scrolling are on to only move vertically or horizontally at a given moment? My understanding is that the directionalLockEnabled property should achieve this, but a diagonal swipe still causes the…
NickD
90
votes
6 answers

Check if a UIScrollView reached the top or bottom

Is there a way to know if a UIScrollView has reached the top or bottom? Possibly in the method: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
Duck
  • 34,902
  • 47
  • 248
  • 470
90
votes
14 answers

How can I programmatically force-stop scrolling in a UIScrollView?

Note: The answer given here doesn't work for me. I have a UIScrollView (not a table view, just a custom thing), and when the user takes certain actions, I want to kill any scrolling (dragging or deceleration) inside the view. I've tried doing e.g.…
Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
90
votes
15 answers

How to Make the scroll of a TableView inside ScrollView behave naturally

I need to do this app that has a weird configuration. As shown in the next image, the main view is a UIScrollView. Then inside it should have a UIPageView, and each page of the PageView should have a UITableView. I've done all this so far. But my…
89
votes
13 answers

Disabling vertical scrolling in UIScrollView

There is an option in IB to uncheck vertical scrolling on a scrollview, but it doesnt seem to work. How can the scrollview be set to only scroll horizontally, and not vertically in the code rather than IB?
some_id
  • 29,466
  • 62
  • 182
  • 304
89
votes
15 answers

Paging UIScrollView in increments smaller than frame size

I have a scroll view that is the width of the screen but only about 70 pixels high. It contains many 50 x 50 icons (with space around them) that I want the user to be able to choose from. But I always want the scroll view to behave in a paged…
Henning
  • 2,710
  • 2
  • 17
  • 16
88
votes
12 answers

UIScrollView horizontal paging like Mobile Safari tabs

Mobile Safari allows you to switch pages by entering a sort of UIScrollView horizontal paging view with a page control at the bottom. I am trying to replicate this particular behavior where a horizontally scrollable UIScrollView shows some of the…
firstresponder
  • 5,000
  • 8
  • 32
  • 38
87
votes
8 answers

UIScrollView pauses NSTimer until scrolling finishes

While a UIScrollView (or a derived class thereof) is scrolling, it seems like all the NSTimers that are running get paused until the scroll is finished. Is there a way to get around this? Threads? A priority setting? Anything?
mcccclean
  • 7,721
  • 10
  • 32
  • 36
87
votes
4 answers

View frame changes between viewWillAppear: and viewDidAppear:

I have discovered a strange behavior in my application, where a connected IBOutlet has its connected view's frame between the calls in my view controller to viewWillAppear: and viewDidAppear:. Here is the relevant code in my UIViewController…
Jumhyn
  • 6,687
  • 9
  • 48
  • 76