uipangesturerecognizer

UIPanGestureRecognizer do something immediately when touched

两盒软妹~` 提交于 2019-11-29 17:53:29
问题 I am new to ios, so I apologize in advance if I am missing something obvious. I am creating a puzzle where I would like the individual puzzle pieces to increase in size on touch and decrease on letting go. Currently I have: -(IBAction)handlePan:(UIPanGestureRecognizer *)recognizer{ if(recognizer.state == UIGestureRecognizerStateBegan) else if(recognizer.state == UIGestureRecognizerStateEnded) } The puzzle piece increases size when the pan begins (which is also when the statebegan) and

unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow

≡放荡痞女 提交于 2019-11-29 01:51:50
I am trying to set up an edge swipe gesture in iOS 8 on iPad but getting and error that seems like a bug. I have the following code: UIScreenEdgePanGestureRecognizer *edgeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightEdgeSwipe:)]; edgeRecognizer.edges = UIRectEdgeRight; [self.view addGestureRecognizer:edgeRecognizer]; and then I handle the gesture: -(void)handleRightEdgeSwipe:(UIGestureRecognizer*)sender { //slide in view code here } The problem is that it doesn't detect the right edge swipe every time. And sometimes it detects it

ios UICollectionView detect scroll direction

最后都变了- 提交于 2019-11-29 01:43:01
I have a collectionView. I want to detect scroll direction. I have a two different animation style for scroll down and scroll up. So I must learn scroll direction. CGPoint scrollVelocity = [self.collectionView.panGestureRecognizer velocityInView:self.collectionView.superview]; if (scrollVelocity.y > 0.0f) NSLog(@"scroll up"); else if(scrollVelocity.y < 0.0f) NSLog(@"scroll down"); This is just work at finger touched. Not work for me Douglas Ferreira Try this: Add this somewhere in you header: @property (nonatomic) CGFloat lastContentOffset; Then override the scrollViewDidScroll: method:

Intercepting pan gestures over a UIScrollView breaks scrolling

耗尽温柔 提交于 2019-11-28 18:10:34
I have a vertically-scrolling UIScrollView . I want to also handle horizontal pans on it, while allowing the default vertical scroll behavior. I've put a transparent UIView over the scroll view, and added a pan gesture recognizer to it. This way I can get the pans just fine, but then the scroll view doesn't receive any gestures. I've implemented the following UIPanGestureRecognizerDelegate methods, hoping to limit my gesture recognizer to horizontal pans only, but that didn't help: - (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer { // Only accept horizontal pans

Detect collision of two UIView's in swift

大憨熊 提交于 2019-11-28 13:57:30
I have two UIViews on my ViewController. I added panGesture to first view and when i start moving this view the second view will move towards first view. I want to detect an event when these two views collides. Here is my code. @IBAction func dragFirstView(sender: UIPanGestureRecognizer) { let translation = sender.translationInView(self.view) dispatch_async(dispatch_get_main_queue()) { () -> Void in UIView.animateWithDuration(2.5, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut, animations: { self.secondView.frame = CGRectMake(sender.view!.center.x + translation.x, sender.view!.center

Adding a UIPanGestureRecognizer and a UISwipeGestureRecognizer to same view causes conflicts after setting requireGestureToFail

旧街凉风 提交于 2019-11-28 04:12:08
问题 I added a swipe gesture recognizer and a pan gesture recognizer to the same view. These gestures should be exclusive to each other. In order to do this I added the constraint on the swipe gesture [swipeGesture requireGestureToFail:panGesture]; (because the pan gesture should get precedence) Problem is that the pan gesture is always invoked - even during a very fast swipe. In order to over come this I set myself as the pan gesture's delegate. In the delegate method I set up some code as

unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow

佐手、 提交于 2019-11-27 16:14:44
问题 I am trying to set up an edge swipe gesture in iOS 8 on iPad but getting and error that seems like a bug. I have the following code: UIScreenEdgePanGestureRecognizer *edgeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightEdgeSwipe:)]; edgeRecognizer.edges = UIRectEdgeRight; [self.view addGestureRecognizer:edgeRecognizer]; and then I handle the gesture: -(void)handleRightEdgeSwipe:(UIGestureRecognizer*)sender { //slide in view code here }

Combining a UILongPressGestureRecognizer with a UIPanGestureRecognizer

依然范特西╮ 提交于 2019-11-27 13:59:45
I d'like to combine a UILongPressGestureRecognizer with a UIPanGestureRecognizer. The UIPanGestureRecognizer should start with a long press. Is there a simple way to do this? or do I really have to write my own gesture recognizer? I wan't something like on the home screen. You press on an icon and after some time the icons start wobbling. Afterwards without releasing my finger from the screen I can start dragging the icon under my finger around. actually, you don't have to combine gesture recognizers - you can do this solely with UILongPressGestureRecognizer... You enter StateBegan once your

Intercepting pan gestures over a UIScrollView breaks scrolling

坚强是说给别人听的谎言 提交于 2019-11-27 11:19:08
问题 I have a vertically-scrolling UIScrollView . I want to also handle horizontal pans on it, while allowing the default vertical scroll behavior. I've put a transparent UIView over the scroll view, and added a pan gesture recognizer to it. This way I can get the pans just fine, but then the scroll view doesn't receive any gestures. I've implemented the following UIPanGestureRecognizerDelegate methods, hoping to limit my gesture recognizer to horizontal pans only, but that didn't help: - (BOOL

custom interactive transition animation

无人久伴 提交于 2019-11-27 07:31:13
I want to implement an interactive transition between two view controllers. I would like it to be a modal or present transition. I want the app to start out on the first view controller and allow the user to swipe down to bring in the second view controller The second view controller should come in and cover the current (first view controller) rather than move it out of the way I understand that I would need to use the following. transitioningDelegate animationController(forPresented:presenting:Source:) interactionControllerForPresentation(Using:) UIPercentDrivenInteractiveTransition I am