How can I transfer a swipe from a UIScrollView to a UIPanGestureRecognizer? - ios

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.

Related

Quick scroll by touching scroll indicator in UITextView

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.

How to swipe view up to reveal a menu at the bootom of the screen using Swift

I would like to create a toolbar/navigationbar that appears at the bottom of the screen when the user swipes up on the screen. I would like it to have a bit of resistance in the same way pull to refresh works at the top of a tableview. However I am not using a tableview in my app.
I have tried searching for anything that would point me in the right direction, however the search terms seem to return results either about swiping to delete or facebook style menus.
How would I achieve the swipe up to reveal? Any advice or links to helpful tutorials would be much appreciated
Thanks in advance
Add the menu view to the view but outside of the screen. Add a UIPangestureRecognizer to the view. In the action of the pan recognizer, change the frame of the menu view according to the pan distance.

Swiping left/right quickly, makes the UIImageView fly off the screen

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.

pretty big lag on my UIButtons?

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.

usability issue with nested scroll views on ios

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.

Resources