Stop `UICollectionViewCell` disappearing after `UICollectionView` bounds change - ios

I have a UICollectionView that animates its bounds when a user lifts their finger from the screen. The collection view either grows or shrinks based on how much the user scrolled. This works great if the user lifts their finger up whilst the UICollectionView is stationary however if they flick the scroll view unexpected results happen.
As you can see the UICollectionViewCell disappears before it has a chance the naturally scroll away.
I am using AutoLayout and therefore animating the constraints of the collection view calling [self.view layoutIfNeeded]; I want to suggest that the animation is getting in the way of the scrolling judging by the way the scrollbar moves, it seems to set the UICollectionView to its projected end contentOffset then animate the slide up.
I would like to know why this effect is happening? And any tips on how to fix it!

Related

TableView height change while scrolling resets contentOffset

I encountered an animation flicker that occurs when dragging down a UITableView. If the height of a UITableView changes during a 'rubber banding' drag, the contentOffset gets set to the contentInset when the table height change animation completes.
Here's a project reproducing the issue, as well as a bad work around. If you drag the table down, you should see the table contents flicker back to the top momentarily.
Anyone have any ideas for a better workaround?
https://github.com/KingOfBrian/AppleBugs/blob/master/ContentOffsetBug/ContentOffsetBug/RZViewController.m

what does animation means in scrollViewDidScroll?

In the doc, I found
scrollViewDidScroll:
If you scroll in code without animation, you will receive this message once.
scroll without animation and scroll with animation, what's the difference?
It means that the view will scroll to that point with an animation (same as if you were using your finger), or it will jump to it directly.
For example, imagine that the user sees the top of the scroll, and you call scroll to the bottom with animation, the user will see all the scroll going down to the bottom, instead of just appearing there.

UIScrollView inside UIScrollView: Scrolling

Setup:
I have a full-screen, parent UIScrollView that has paging enabled. Then I have a small, second UIScrollView inside of the first one, with also paging enabled.
Problem:
If I swipe the second UIScrollView, it scrolls fine untill it runs out of pages, then the parent UIScrollView takes over scrolls. For example, if I am on the last page on the second UIScrollView, swipe to left, the parent UIScrollView begins to scroll to right. I tried enabling exclusiveTouch, but no change.
Question:
Is there a way if I scroll the second UIScrollView, only that will scrolls and stops, the parent UIScrollView will never move from that original swipe?
You can set scrollView.scrollEnabled = NO; when other scroll is moving. You can detect when scroll begin dragging and didScroll.
You can get everything with basic scrolling with full screen view from this one
https://github.com/zvonicek/ImageSlideshow
Trust me it really work and also work at rotating device.

Zooming and moving a UIScrollView at the same time

I have a UIScrollView that takes up a portion of the screen, and its basic functions (scrolling and zooming) work just fine. For example, I can grab the scrollview with two fingers, and scroll left and right, while zooming in or out on the content.
I want to add the ability to move the UIScrollView up and down at the same time. Please note that I do not want to move the content of the scroll view, but the scroll view itself.
I have attempted to add a UIPinchGestureRecognizer to the UIScrollView which has allowed me to grab and move the scroll view, but I then lose the zoom and scrolling. It seems that adding a gesture recognizer makes all of the default actions stop (also, when I call setZoomScale, I get an EXC_BAD_ACCESS).
I've also considered checking touches, but touches on the UIScrollView aren't registered with the main view so I can't change its location using those values.
Does anyone have any suggestions on how this might be accomplished?

horizontal scrolling of a scrollView in a scrollView - small problem

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.

Resources