Is there anyway to produce a vertical scroll view that will have the illusion of an endless continuous scroll?
Apple has released sample code for something called StreetScroller that does this for a horizontal scrollview but can this be reproduced for a vertical one?
Try This it is a great control the allows horizontal and vertical infinite scrolling.
Related
I've just vertical scrolling a few times in the past, but now I'm trying to implement horizontal scrolling but when I run it it doesn't scroll.
What is the problem with it?
P.S. is it possible to design and layout views using a storyboard for scrolling? In this example the blue view is still visible within the screen representation, so its ok to deal with, but suppose I wanted to add another view which is further to the right and thus not visible within the screen representation? Is there anyway of visually designing a scroll view where you can see all the entirity within the storyboard what it will look like?
You don't have a trailing constraint on the scroll view's direct subview, so the scroll view cannot compute the correct contentSize.
Also, it's easier to understand the constraints in the document outline if you give each view a unique label. You have two views labelled “View” so it's difficult to be sure which constraints connect to which “View”.
The UICollectionView disables scrolling by default when there is not enough cells in the view. When this occurs I need it to bounce back to position when pulled. Im am aware of a hack where I can fill the UICollectionView with empty tables to enable scrolling but I was hoping there would be a slightly more fluid example as
I don't want the view to scroll but instead to automatically bounce back to its position. This is because of the effect I have implemented below as can see below.
https://youtu.be/r75xB9-Mb4g
Is there a way to achieve this simply, when there is not enough cells in the UICollectionView the scroll is disabled.
For vertical scrolling:
self.collectionView.alwaysBounceVertical = true;
For horizontal scrolling:
self.collectionView.alwaysBounceHorizontal = true;
I don't know How to make UITableView scroll both horizontally and vertically as Kickstarter ios app. Would you please explain briefly how can they do both way? Thank you.
Tab scroll horizontally
Tab scroll vertically
P/s: sorry, my reputation point is so low that i cannot embed the image.
There are actually two different levels to the two directions of the "table view". The vertical scrolling is some sort of paginated table/scroll/collection view; this can be accomplished using a table view, a scroll view, or a collection view. Here's a great answer on how to do vertical paging in a scroll view. Within each page, it looks like a UICollectionView.
That is simply a vertical UIScrollView with paging enabled. Each page is populated with a horizontal UICollectionView.
I want to implement a paging UIScrollView that will scroll in both directions (vertically, and horizontally). The default behaviour of UIScrollView is to be one, or the other. Not both.
Is it possible to implement a UIScrollView that would allow paging in both directions? For example, the user would be able to scroll left and up for the previous page with paging in UIScrollView, right and down for the next page.
I can use UIScrollView to implement scrolling horizontally with paging but I can't see how UIScrollView can be scrolled in both directions while paging. How could I implement this behaviour? UIScrollView ? or CAScrollLayer? or anything else?
Any suggestion are appreciated.
You seem to be talking about two different things here: scrolling and paging.
Scrolling is just flicking around to move the screen's viewport over a view that is larger than the screen itself. Normally you set this up by giving a UIScrollView a subview that is larger than it, and setting the UIScrollView's contentSize to the size of the larger thing.
There's nothing magic about it. If contentSize is taller than the UIScrollView's size, the scroll view will scroll vertically. If contentSize is wider, it will scroll horizontally. If contentSize is both taller and wider, then you'll scroll both vertically and horizontally.
Paging is a different matter. To know how to make it so "you can scroll left and up for the previous page", we'll need to know what a page looks like in your program, how it's represented, etc. From the small description you're giving, I think UIScrollView probably isn't the way to go. Instead, look into UIPanGestureRecognizer and some sort of animated transition between views?
But if that doesn't help, you'll need to give us some more details to work with.
I have a multidirectional UIScrollView within a horizontal UIScrollView within a vertical UIScrollView. When I reach the horizontal content limit of the innermost scrollView, the containing horizontal scrollview begins scrolling just as I want.
But when I reach the vertical content limit of the innermost scrollView, I do not get any action on the top level vertical scrollView.
If all vertical content is visible at innermost level (so no vertical scrolling is possible), then the top level vertical scrollview takes over fine. Any clues on how to fix this?
I get this same behavior with Apple "PhotoScroller" sample code if I embed their photo paging scrollView in a vertical scrollView. If the photo is not zoomed, then both the horizontal and vertical scrollviews will work. If the photo is zoomed but panning stops because it has hit the horizontal or vertical limit, then only the horizontal scrollview works.
This is using an older version of the sample code that implements the photo paging as a UIScrollView rather than UIPageViewController. With current UIPageViewController version, paging is not possible when the photo is zoomed.
To answer my own question, I used gestureRecognizerShouldBegin: delegate to determine whether the innermost scrollView was at a boundary when the pan gesture began. If so, I responded to shouldRecognizeSimultaneouslyWithGestureRecognizer:
delegate to enable the UIPanGestureRecognizer on both the inner scrollView and the vertical scrollView. This allowed a single gesture to scroll both simultaneously. Then, I over-rode setContentOffset on both scrollViews to suppress the scrolling on the wrong one.
I think a better answer is probably to replace the UIPanGestureRecognizer on the inner UIScrollView with a custom gesture recognizer that cancels itself when started at a boundary and dragging past the boundary. But, I could not get that to work.
Still not clear to me why the horizontal version of this just worked automatically. Perhaps there is some special case handling in the UIScrollViewPanGestureRecognizer to handle horizontal case, or interaction with immediate superView.