While zooming in, UIScrollview calls scrollViewDidEndDecelerating - how to stop it? - ios

When I zoom a photo in UIScrollView and push it down or up, the scrollViewDidEndDecelerating method gets called. However, I don't want it until I scroll to the next image.
How to stop it?
For more info: I have one UIScrollView which includes 3 image view middle image view in another inner UIScrollView.

It seems that you need to switch your UIScrollView to paging mode. See here and here for info. See this answer too.

Related

UITableView scroll at top issue iOS

I have a tableview and I would like to know when user scroll at top and if in those moment the tableview is not at top (for example its at middle) I just implement the delegate method scrollViewDidScroll and check the value of content offset and its ok.
My problem is when the tableview is is already at the top and scrollViewDidScroll is not called (I want to know if the user do the gesture for scroll to the top even if it is already at the top).
For this reason I thought to add a pan gesture to tableview but I saw that create problems about scrolling and the implementation is cumbersome.
I ask to you if you know another way to achieve this or the only way is adding pan gesture.
You should try to use scrollViewWillBeginDragging or scrollViewWillEndDragging

UIScrollView Zoom on shake effect

I am working on application in which i need to zoom the scroll view on shake effect so user will not touch the screen to pinch or double tap.
I have implemented the code by looking in to this tutorial:
Zoom UIScrollView with multiple images
I got the call in a delegate:
viewForZoomingInScrollView
But the image view not zoom in or out.
When i touch the screen after the delegate called the scroll view is zoom in. But content in scroll view not zoom in or out. It remains as it is.
Even some time i did not get call in the following delegate:
scrollViewDidZoom
scrollViewDidEndZooming
So do i need to call layout subview after viewForZoomingInScrollView if yes where?
From my understanding the view is not zooming because i have not pinch or double tap the scroll view.
Please help me out.
Those you mentioned are UIScrollView delegate methods and they are called when the scrollView will\did actually zoom, not to perform the zooming.
To perform the zoom programmatically you need to use zoomToRect:animated: and passing the portion of your scorllView's subview you want to scroll and wether it needs to be animated or not.
Hope it helps.

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.

How To Show Scrollbar Always On UICollectionView

I have a UICollectionView added to a UIView in an app I am working on. Displayed in the UICollectionView I have a set of images pulled from Core Data. The vertical scrolling works fine but the scrollbar does not display until the user touches the UICollectionView.
How can I make sure the scrollbar at the right is always visible so that an indication is given to the user that it is scrollable?
You can't make them always visible. Instead, you can flash them once, when the user is first presented with the collection view to notify them, that this view can be scrolled.
Since UICollectionView is a subclass of UIScrollView you can do this:
[myCollectionView flashScrollIndicators];
Check out the Settings app for instance. When you go to a settings list that is longer then the screen, the scroll indicator is flashed once.
FYI for Swift:
myCollectionView.flashScrollIndicators()

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?

Resources