I'm designing a UI with a horizontal collection view (see below) I can scroll left or right to see the cells but when I let go, it bounces back to the center. The behavior I want is that when you scroll to cells off screen, it stops on them (not bounces back). Unchecking Bouncing on Scroll in the attributes inspector has no impact, unchecking Bounce Horizontally doesn't let me scroll at all. How can I achieve the desired behavior?
Related
To elaborate on my question, I've three scrollviews one top of another, let say base, middle and top. Base scroll view's content size is more so it will scroll, middle scrollview's content size is equal to its frame so it will not scroll, top scrollview's content size is more than its frame so it will also scroll.
Now when I scroll the top scrollview, once it reaches its end, I"m expecting it would scroll the base scroll view as middle is not scrollable. But it seems middle scroll view consumes all my scroll events and not letting the scroll event to go to base scroll view.
I"ve tried by setting more content size to middle scrollview, then it working as expected, first top scroll view scrolls fully then it passes the scroll event to middle scroll view then to the base scroll view.
Now it is more evident that middle scrollview (which is non scrollable) is consuming all of my scrolling event from going to base scroll view. How do I prevent that.
Note : As I've to support zooming, I need scroll view in all three levels.
Any help would be really appreciated.
Thanks.
I have a scroll view .I want to scroll it in both direction horizontal and vertical.But when i am scrolling the subview is bouncing as both scrolling are enabled. how to mange this issue like when i am scrolling the view vertically,horizontal scroll should be disabled.
Set the directionalLockEnabled property to YES.
However,
If the drag direction is diagonal, then scrolling will not be locked
and the user can drag in any direction until the drag completes.
Set scrollview.directionalLockEnabled to YES
Note: If this property is NO, scrolling is permitted in both
horizontal and vertical directions. If this property is YES and the
user begins dragging in one general direction (horizontally or
vertically), the scroll view disables scrolling in the other
direction. If the drag direction is diagonal, then scrolling will not
be locked and the user can drag in any direction until the drag
completes. The default value is NO
I'm trying to create a UITableView that can scroll both vertically and horizontally. The way I went about implementing this is putting a UITableView (scrolls up and down) inside of a UICollectionViewCell that I set to scroll horizontally (left and right) only. Code-wise, the solution looks pretty darn clean (and elegant in my book because of it), however, I'm experiencing some issues with vertical scrolling on the table view.
Normally, when you vertically scroll on a UITableView, it will keep track and remain where you left off in the scrolling -- as in the table view will not reset or move its scrolling position to a good bit above of where it left off. As you might've guessed, this is what I'm experiencing with my implementation where if I scroll to the very bottom of my table view, its scroll position gets moved to a bit above where I left off and I cannot naturally see the last entry in my table view without having to force a scroll to the bottom in order to reveal it.
Any ideas what might be causing this? I configured all of the settings for the UITableView, UICollectionView and UICollectionViewCell within the Interface Builder -- most important thing being I set the UICollectionView and its UICollectionViewFlowLayout scroll directions to Horizontal. I'm not sure if that's somehow being overwritten somewhere…
This is what you are looking for I believe.
UIScroll view lets me declared a scrollable area when I have too much content for one page. Strangely, the scroll view in question behaves as desired in the X-axis, with no scrolling whatsoever allowed. Unfortunately, the Y axis -- where scrolling is necessary -- doesn't 'clip' the allowed scroll area to the content size. The user can scroll outside of the content size, and only after they let go does scroll view 'bounce' back to the allowed zone.
I want to prevent the user from scrolling further up than there is content to view (down doesn't bother me) because it looks 'wrong' to have the header at the top of the scroll view pull down, leaving the regular background behind it.
If you are making your UIScrollView in interface this is as simple as deselecting the
"Bounces, Bounces Horizontally, and Bounces Vertically"
check boxes in your scrollView's attributes. If you are designing the UIScrollView in code you can add this.
self.textView.alwaysBounceHorizontal = NO;
self.textView.alwaysBounceVertical = NO;
self.textView.bounces = NO;
i have a scrollView that fits the whole screen. In that View i show some UIImages that scroll horizontally. Like in the PageControl Project from Apple.
Then, when the user taps the screen, i fade in a scrollView at the bottom with some other images. Also horizontally scrolling. Like in the ScrollView Project from Apple.
My problem is, that when i come to the end of the scrollView which was faded in, the upper scrollView also starts to drag. How can i stop that during activation of the second scrollView?
Redraw the frame limits on your first scrollView when the second enters the screen. That way, your touches won't respond to both views. This means you need a container-view to keep both views seperated from each other.
Then you just rescale it back whenever your second scrollView disappears.
Edit: or disable scroll in your first scrollview while the second is open.