Following from #Rob's answer in the following link:
https://stackoverflow.com/a/10407713/1692914
#Rob
Thanks for your example. I have a problem though, if I swipe the screen quickly what happens is the imageViews fly from left to right (or vice versa) depending on the animation and they disappear from the screen without appearing in the view as they should when I swipe the screen slowly.
Related
I'm trying to create the effect seen in some iOS apps where swiping the screen scrolls the ScollView/TextView normally, but sliding on the far right (where the scroll indicator is) creates a quick scrolling effect that allows the user to scroll through the position in the overall length of the view. For example, sliding on the far right from the middle of the screen to the bottom would take the TextView from the middle of its content to the very end.
Is there any pre-established way to do this, or is this an effect I would have to create from scratch?
Thanks a lot for any help, and I'm sorry if this question wasn't very clear.
I have created a horizontal scrollview in swift with 3 view controllers and it almost works fine except for one thing. When I scroll between view controllers, it is possible for half of one view controller to take up one half of the screen and the next view controller in the other half. I was wondering if there was any way to prevent this so that the view controllers do not get "stuck" halfway and that there will always be only one view controller displaying on the screen.
-Also on a side note I have one left and one right swipe gesture within one of the viewcontrollers in this scrollview, and I noticed that after about 7-10 swipes, the screen no longer responds to the swipe gestures(left, right). Any clues as to what could be solving this?
If anyone could answer or attempt to steer me in the right direction for solving one or both of these questions, it would be greatly appreciated.
First, you need to enable pageing for your scrollview. You should be using something like
scorllView.isPagingEnabled = true
Then most importantly, you to make this paging work, each "page" in your scroll view must has equal width with your scroll view.
Maybe a bad title, but I did my best.
Here's what I have: A menu on the left side, which can be opened by panning (from a small vertical bar to almost half my view). The designer thought it a good idea to insert a horizontally scrolling menu right there.
I made all this, but when I scroll horizontally in my menu (so not opening or closing the menu), I can't close the menu by swiping the scrollview more to the left, because it bounces (it also does not work when bouncing is off).
Does anyone have an idea how I can trigger my UIPanGestureRecognizer when the UIScrollView is scrolled beyond its right edge? Or any other idea how I can solve this?
The reason I made this title is because I have all the code for opening and closing the menu in my UIPanGestureRecognizer, and I think it's better if I just trigger the recognizer instead of re-writing some code.
i have a game with like 48 buttons that i have in a 6 x 8 grid. the games kind of like a chess game in the layout, so its kind of important to have all those buttons. well if you can imagine a chess game that the layouts so big that i may need a vertical scroll view so that the user can scroll up and down to play the game fully. And, when i scroll i obviously don't want my navigational buttons at the top scrolling too (menu button for example). So, what i did was i made a view controller, i added a UIView, then inside the UIView i added a scroll view, and inside that scroll view i added first all my 48 buttons for my chess-like game and then my bg for that game, so that the when the user vertically scrolled not only the bg would scroll but also all the buttons too. I did all the code and everything to make my scroll view work, and then lastly i put my navigational buttons (menu, pause etc..) inside my first view i made underneath the scroll view (so that it was layered correctly)
well, after i did this my scrolling worked fine, except there was a lag when i tried to press one of my 48 buttons. This was a lag that i did not experience before i put all my buttons inside a scroll view. Before this my buttons performed fantastically, but now that they were in a scroll view, they lagged a very little bit. Like when you touch the button it takes the button about a fifth of a second to change instead of instantaneous. Its a small lag, but definitely noticeable. Yet, when i try and touch my navigational buttons (that are not embedded in a scroll view) there is no lag at all,
Did i do anything wrong by putting my buttons in a scroll view? If so, what else can i do to get my buttons to scroll without my navigational buttons scrolling.
ANY HELP IS APPRECIATED!
EDIT: I'm running this on the simulator if that makes a difference
I believe that this is something to do with responder, and the fact that both your UIButton and the UIScrollView need to know what to do with your touch.
If you put your finger on the UIButton, the UIScrollView will also see this touch. The UIScrollView is interested to know if this touch is going to turn into a drag, therefore waits to see if you move your finger. Perhaps this is blocking your UIButton from firing.
I have a horizontal scroll view with paging enabled, and the children of this scroll view are vertical scroll views. It's like the iOS home screen, but imagine scrolling vertically on each home screen.
Now, when the vertical scroll is in progress, it's hard to swipe to the next or previous screen, because the vertical scroll view apparently captures the events. Even if the angle of the swipe is almost horizontal, it doesn't go to the next or previous "page". Only after the scroll stops fully can one easily swipe to the next or previous pages.
Unfortunately, because of the slow deceleration, the user might think the content stopped moving when it is in fact moving very slowly and just about to stop. But the horizontal swipe is interpreted as a vertical scroll gesture, and the scroll velocity increases, making things worse from the user's perspective.
I've noticed multiple people struggling with this when they test out our app, and I wonder if anyone here knows a solution, perhaps a way to consider the angle of the swipe to determine which scroll view should process the event. Thanks.
I would suggest stopping the vertical scroll on a touch begins event. This is how most apps I've seen do something like this.