Questions tagged [uiscrollview]

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

uiscrollview
Filter by
Sorted by
Tagged with
1792 votes
99 answers
652k views

How can I make a UITextField move up when the keyboard is present - on starting to edit?

With the iOS SDK: I have a UIView with UITextFields that bring up a keyboard. I need it to be able to: Allow scrolling of the contents of the UIScrollView to see the other text fields once the ...
625 votes
35 answers
366k views

UIScrollView Scrollable Content Size Ambiguity

Fellow devs, I am having trouble with AutoLayout in Interface Builder (Xcode 5 / iOS 7). It's very basic and important so I think everyone should know how this properly works. If this is a bug in ...
Wirsing's user avatar
  • 6,773
341 votes
31 answers
255k views

UIScrollView scroll to bottom programmatically

How can I make a UIScrollView scroll to the bottom within my code? Or in a more generic way, to any point of a subview?
nico's user avatar
  • 9,708
281 votes
20 answers
174k views

Is it possible for UIStackView to scroll?

Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView scroll?
itsaboutcode's user avatar
  • 24.8k
256 votes
10 answers
145k views

How can I mimic the bottom sheet from the Maps app?

Can anyone tell me how I can mimic the bottom sheet in the new Apple Maps app in iOS 10? In Android, you can use a BottomSheet which mimics this behaviour, but I could not find anything like that for ...
qwertz's user avatar
  • 6,226
229 votes
22 answers
140k views

Stop UIWebView from "bouncing" vertically?

Does anyone know how to stop a UIWebView from bouncing vertically? I mean when a user touches their iphone screen, drags their finger downwards, and the webview shows a blank spot above the web page I ...
Brad Parks's user avatar
  • 68.9k
202 votes
12 answers
152k views

How to add leading padding to view added inside an UIStackView

This is my setup: I have an UIScrollView with leading,top, trialing edge set to 0. Inside this I add an UIStackView with this constraints: stackView.centerYAnchor.constraintEqualToAnchor(...
Adrian's user avatar
  • 19.8k
198 votes
24 answers
170k views

Finding the direction of scrolling in a UIScrollView?

I have a UIScrollView with only horizontal scrolling allowed, and I would like to know which direction (left, right) the user scrolls. What I did was to subclass the UIScrollView and override the ...
Alex1987's user avatar
  • 9,457
190 votes
17 answers
141k views

Get UIScrollView to scroll to the top

How do I make a UIScrollView scroll to the top?
Jack Humphries's user avatar
179 votes
10 answers
201k views

Programmatically scroll a UIScrollView

I have a UIScrollView which has several views. When a user flicks their finger, the view scrolls to the right or left depending on the direction of the finger flick. Basically my code works in a way ...
climbon's user avatar
  • 2,273
177 votes
18 answers
91k views

How can I use Autolayout to set constraints on my UIScrollview?

I have spent two days trying out the various solutions for Mixed and Pure Autolayout approaches to achieve what was a trivial scrollview setup prior to autolayout, and it's now official - I must be ...
user1459524's user avatar
  • 3,603
172 votes
22 answers
155k views

How to detect when a UIScrollView has finished scrolling

UIScrollViewDelegate has got two delegate methods scrollViewDidScroll: and scrollViewDidEndScrollingAnimation: but neither of these tell you when scrolling has completed. scrollViewDidScroll only ...
Michael Gaylord's user avatar
172 votes
5 answers
122k views

What's the UIScrollView contentInset property for?

Can someone explain to me what the contentInset property in a UIScrollView instance is used for? And maybe provide an example?
ForeignerBR's user avatar
  • 2,469
155 votes
28 answers
84k views

Center content of UIScrollView when smaller

I have a UIImageView inside a UIScrollView which I use for zooming and scrolling. If the image / content of the scroll view is bigger than the scroll view, everything works fine. However, when the ...
hpique's user avatar
  • 120k
151 votes
7 answers
99k views

Is there a way to hide the scroll indicators in a UIScrollView?

I've got a use case where those indicators disturb the user interaction. Can I subclass and override a method or do something similar to remove the scroll indicators from the scroll view?
Thanks's user avatar
  • 40.3k
140 votes
25 answers
197k views

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's user avatar
  • 9,404
136 votes
27 answers
148k views

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? ...
Mark's user avatar
  • 14.9k
132 votes
17 answers
134k views

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 ...
Alex Reynolds's user avatar
102 votes
15 answers
124k views

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 ...
Rahul Vyas's user avatar
  • 28.5k
100 votes
14 answers
72k views

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 ...
user avatar
95 votes
18 answers
66k views

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 "...
George Armhold's user avatar
91 votes
14 answers
116k views

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 ...
Ben Zotto's user avatar
  • 70.5k
91 votes
6 answers
67k views

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)...
Duck's user avatar
  • 35.5k
91 votes
21 answers
64k views

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 ...
user avatar
91 votes
15 answers
111k views

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 ...
Marcela Mukel Balady's user avatar
89 votes
13 answers
113k views

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 ...
some_id's user avatar
  • 29.6k
89 votes
15 answers
43k views

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 ...
Henning's user avatar
  • 2,710
88 votes
12 answers
47k views

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 ...
firstresponder's user avatar
87 votes
4 answers
44k views

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 ...
Jumhyn's user avatar
  • 6,747
87 votes
8 answers
20k views

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 ...
mcccclean's user avatar
  • 7,821
85 votes
17 answers
59k views

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 ...
Mark Bourke's user avatar
  • 9,886
84 votes
2 answers
76k views

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 ...
H Bellamy's user avatar
  • 22.5k
84 votes
11 answers
46k views

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 ...
SirRupertIII's user avatar
  • 12.4k
82 votes
10 answers
57k views

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's user avatar
  • 7,173
80 votes
8 answers
167k views

Set UITableView content inset permanently

In my app I have a UISearchBar under UINavigationBar so it is always visible to user. In that case I had to set contentInset with extra 44px so the UIScrollView will be scrolling under UISearchBar (...
cojoj's user avatar
  • 6,445
79 votes
4 answers
86k views

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 ...
SirRupertIII's user avatar
  • 12.4k
78 votes
5 answers
42k views

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 ...
TemptingFriendlyGrison's user avatar
77 votes
24 answers
44k views

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 ...
Tobias Kräntzer's user avatar
76 votes
8 answers
75k views

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 ...
Kenneth Ballenegger's user avatar
75 votes
9 answers
34k views

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 ...
Pranav Ramesh's user avatar
73 votes
3 answers
82k views

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 ...
progrmr's user avatar
  • 76.6k
72 votes
4 answers
52k views

UIScrollview getting touch events

How can I detect touch points in my UIScrollView? The touches delegate methods are not working.
user avatar
70 votes
7 answers
38k views

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 ...
bhavya kothari's user avatar
69 votes
6 answers
40k views

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 ...
DBD's user avatar
  • 23.1k
69 votes
7 answers
55k views

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 ...
William Jockusch's user avatar
69 votes
12 answers
54k views

Change page on UIScrollView

I have a UIScrollView with 10 pages. I am able to flick between them. I also want to have 2 buttons (a back button and a next button) which when touched will go to the previous or next page. I can't ...
john's user avatar
  • 765
69 votes
3 answers
52k views

What does contentOffset do in a UIScrollView?

What is the use of the contentOffset property in UIScrollView?
Akash's user avatar
  • 703
67 votes
16 answers
71k views

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 ...
mlevi's user avatar
  • 1,443
67 votes
8 answers
64k views

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 ...
mahboudz's user avatar
  • 39.3k
67 votes
11 answers
28k views

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 ...
Rabih's user avatar
  • 671

1
2 3 4 5
251