Menu
  • HOME
  • TAGS

UILongPressGestureRecognizer crashes in tableview when dragged to top of view - SWIFT

ios,swift,tableview,uilongpressgesturerecogni

When you call self.routeTableView.indexPathForRowAtPoint(location)! you are force unwrapping the value that comes back, and in this case, its nil. This is where you are crashing. Your code should do something like this: if let indexPath = self.routeTableView.indexPathForRowAtPoint(location) { //do normal code } else { //the point didn't map back to...

UILongPressGestureRecognizer on UIButton

ios,swift,uigesturerecognizer,uilongpressgesturerecogni

You can't do it with a gesture. You would need to implement the underlying touch management methods from UIControl and track the touches begin and end (and use your own timer). Once the gesture has fired it needs to end and be started again by a new touch. I suppose...

How do I keep a UILongPressGestureRecognizer active while switching from a UIViewController to another

ios,objective-c,uiviewcontroller,uigesturerecognizer,uilongpressgesturerecogni

ofcourse there might be a requirment to use a UIPanGesturerechognizer, why dont you enable or add it to the parent view on long press?

Continuous animation in iOS?

ios,uiview,catransform3d,animatewithduration,uilongpressgesturerecogni

I am not sure if I understood your question correctly, here I share a method that listens to longPressRecognizer and animates a view as long as user presses onto that view. As user stops pressing, view animates back to its default state. You can check if user gesture satisfies your...