I have a weird issue which I'm sure someone can help fix easily. I have a UIImageView within a UIScrollview which I'm able to scroll up to the top. I have paging enabled and it's working as expected except for one problem. After I scroll the image all the way to the top and it snaps, as soon as I touch anywhere in the UIScrollView, it automatically scrolls the UIImageView back down. Any ideas on how to prevent this?
Thanks!
Fixed the issue by playing with the UIScrollview's content size.
Related
I'm looking for a way of 'sticking' a UIScrollView to it's position unless the touch has been moved by a certain threshold, at which point it will jump to where it should have scrolled to and continue scrolling.
The reason for this is that I have a vertical scroll and each cell inside the UIScrollView has a horizontal scroll. So I'd like to introduce a slight 'stickyness' to make sure the user doesn't accidentally scroll vertically when they mean to scroll horizontally.
I started by hijacking the contentOffset property in scrollViewDidScroll. The trouble with that is I cannot find out how much the scrollView would have moved by if I were setting the contentOffset
If I try to add a UIPanGestureRecognizer to the class then it overrides the UIScrollView and the UIScrollView becomes unresponsive.
Does anyone know a way to do this?
EDIT: edits based on comments.
I have a paged scroll view in my app and it works almost perfectly... Usually one page looks like this:
There is no content below this, but when i move it as if it should scroll down (clicking and swiping upwards) it stops moving at this stage:
It's as if its decided that that is an acceptable page loaction or something. If i drag it part way up it snaps the rest of the way up, and if i drag it part way down it snaps all the way down.
Why is it considering this an acceptable place to stop? Is there an easy property to set im missing? Or is there a way to allow only horizontal scrolling?
Thanks
Check the contentSize property of the scroll view. That determines how far it will scroll, and you can manually set it to control exactly where it will scroll to.
Is the scroll view on 0,0 on the canvas? It looks like it is not actually centered on the screen.
Anyone here happen to know how I might go about making a UIScrollView paging less sensitive?
I am only scrolling left or right, but if I scroll a single pixel in the horizontal direction, the UIScrollView rockets off to the next page. I understand that the paging property stops on multiples of the scrollview's bounds, and that's totally fine. I just don't want this to happen unless it's abundantly clear the user wants to do this.
Can this be done using the native functionality of UIScrollView or will I have to override touch events and code this myself?
Thank you in advance!
I use UIScrollview to scroll vertically some images(their number is 100) and when i scroll Up/Down the next/previous image appear suddenly, and i don't want this i want a continuous effect. Can someone help to do that. Thanks.
Are your setting pagingEnabled=YES; ?
Try setting 'pagingEnabled=NO;' while configuring your UIScrollView
I am implementing a scrollview based on the code of Scrolling Madness found on git and I update it for an infinite image scrolling like a magazzine using three uiimageviews:
- 1st uiimageview: last page
- 2nd uiimageview: first page
- 3rd uiimageview: second page
The code uses the scrollRectToVisible to center in the screen the second uiimageview but when I start zooming it with the fingers on the center, the image moves to the right, leaving a part on screen and the left size on blank. The zoom works fine and everything but the behavior of the image isn't the correct.
I checked the Scrolling Madness project and I replicated the same behavior. The second image moves to the right, and the third one goes off screen.
Any ideas of how to correct this? I have tried to modify the contentoffset and other options of the scrollview but no success.
I found another solution that worked for me after seeing another zoom project on the web. In the Scrolling Madness project, in the setZoomingMode function, set your scrollview's content size the same as your uiview that will be zoomed. Also, in my case, I modified the uiview's frame's origin to make it visible on the screen.
I found a very useful method that solved the problem on this page: http://idevzilla.com/2010/10/04/uiscrollview-and-zoom/