uipangesturerecognizer

Using UIPanGestureRecognizer in Xcode and velocity to determine swipe direction is too sensitive and switches rapidly between directions

那年仲夏 提交于 2019-12-23 19:17:27
问题 Clarification: What I'm trying to achieve is this: the swiping gestures (up, down, right and left) are on a WebView. When any of the gestures occur this is what it needs to happen: as soon as the swipe begins, an action must begin (the action is actually loading a html link which moves an ip camera to either up,down,right,left). The html link makes the camera to go all the way to the right or left or up or down. I have another html link which when loaded will tell the ip camera to stop. So

iOS: How sync two UIScrollview

自作多情 提交于 2019-12-22 08:13:13
问题 I have two horizontal UIScrollview s. I want to synchronise their scrolling when user drag fingers in either of them. Here is my code: self.topScrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; self.topScrollView.delegate = self; self.topScrollView.bounces = YES; self.bottomScrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; self.bottomScrollView.delegate = self; self.bottomScrollView.bounces = YES; ... - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { if

Drag and Drop Image from UICollectionView to UIView?

♀尐吖头ヾ 提交于 2019-12-22 05:43:12
问题 Is it possible to drag an image from a collectionViewCell into a UIView? I am creating a game where the user can pick a number of items to play with in the next VC. I'm representing each item as an image and the user can select each item by dragging the image to bottom of the screen. The image would then be reset to its original location. If I have the UICollectionView functions in my code, with the image selected in a class of UIViewCollectionView all set up correctly... What do I need to

my UIViews muck-up when I combine UIPanGestureRecognizer and autolayout

烈酒焚心 提交于 2019-12-22 05:33:33
问题 I’d like a ball to track my finger as I drag it along a circular trajectory for every allowable device orientation on iPhone or iPad. Views appear to be correctly centred when a device is rotated but the ball will not stay on the circumference and seems to go anywhere when I drag it. EDIT Martin R's answer now displays this as required. My only additional code change was to remove an unnecessary declaration var shapeLayer = CAShapeLayer() The maths in this example made perfect sense until I

Continuous scrolling between UIPanGestureRecognizer and re-enabled UIScrollView

一个人想着一个人 提交于 2019-12-22 03:24:33
问题 I've got a UIScrollView with paging enabled, and I've added my own UIPanGestureRegonizer to it. Under certain instances, my view controller will set scrollview.scrollEnabled = NO , and then add the pan gesture recognizer to it (I'm not using the scrollview's own recognizer). So, scrolling is disabled but I'm waiting for user touches from my gesture recognizer. When it recognizes, it calls its action in which I re-enable scrolling. The problem is, while the user still has a finger down, my

I've made UIPanGestureRecognizer only detect mostly vertical pans, how do I make it only detect REALLY vertical pans?

十年热恋 提交于 2019-12-22 00:51:00
问题 I just implemented this: - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)panGestureRecognizer { CGPoint translation = [panGestureRecognizer translationInView:someView]; return fabs(translation.y) > fabs(translation.x); } (As outlined here.) But if the user pans vertically just over the diagonal it will start. How do I make the tolerance much more strict for what it considers vertical? Basically, the image below describes what I'm after. The first diagram is what it detects now,

How to use UIGestureRecognizerDelegate?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 15:21:28
问题 My Setup I'm trying to replicate Google Now's card interface. I have a UIView which is a subview of (inside) a UIScrollView . Both are controlled from the same UIViewController . The UIView has a UIPanGestureRecognizer attached to it by the UIViewController . The UIScrollView is used to scroll up and down. The UIPanGestureRecognizer is used to swipe away the UIView . The Problem I can't scroll when I'm touching the UIView (the card) The Question How do I implement UIGestureRecognizerDelegate

How to use UIGestureRecognizerDelegate?

China☆狼群 提交于 2019-12-21 15:21:05
问题 My Setup I'm trying to replicate Google Now's card interface. I have a UIView which is a subview of (inside) a UIScrollView . Both are controlled from the same UIViewController . The UIView has a UIPanGestureRecognizer attached to it by the UIViewController . The UIScrollView is used to scroll up and down. The UIPanGestureRecognizer is used to swipe away the UIView . The Problem I can't scroll when I'm touching the UIView (the card) The Question How do I implement UIGestureRecognizerDelegate

How can I apply an angular impulse to a Sprite Kit node based on a pan gesture velocity

本秂侑毒 提交于 2019-12-21 06:27:21
问题 What I'm looking to do here is to spin a SKSpriteNode around its anchor point and have its speed and direction match a pan gesture. So if my pan gesture is clockwise around the sprite then then sprite spins clockwise. The problem I have with my code is that it works great for pans below the sprite from left to right/right to left, but not at all when I try and pan vertically and it makes the sprite spin the wrong way if I pan above the sprite. Here's what I've got so far - let windmill =

How to get current touch point and previous touch point in UIPanGestureRecognizer method?

浪子不回头ぞ 提交于 2019-12-21 04:04:45
问题 I am new to iOS, I am using UIPanGestureRecognizer in my project. In which I have a requirement to get current touch point and previous touch point when I am dragging the view. I am struggling to get these two points. If I use touchesBegan method Instead of using UIPanGestureRecognizer , I could get these two points by the following code: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ CGPoint touchPoint = [[touches anyObject] locationInView:self]; CGPoint previous=[[touches