Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
swift get position of finger when is pressed longer

I have a scrollview and would like to get the exact position of the finger when the user presses the screen longer. Or if that's possible just get the position of the finger in a scrollview when the finger is moving.

So far I've tried using a LongGestureRecognizer. Here is my code, it all works, but I still need the exact position of the finger. Here how I created the Scrollview and the GestureRecognizer.

    testScroll = UIScrollView(frame: CGRect(x: 0, y: 0, width: width, height: height))
    self.view.addSubview(testScroll)
    testScroll.contentSize = CGSize(width: width, height: height*1.25)
    testScroll.delegate = self
    
    testREc = UILongPressGestureRecognizer(target: self, action: #selector(testprint(sender:)))
    testScroll.addGestureRecognizer(testREc)

if there is a possibility to get the position this way, or exactly via the (testprint func), it would be helpful for me

If you have any tips, I would appreciate your help.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Set the delegate of your UILongPressGestureRecognizer and implement gestureRecognizerShouldBegin().

There you can get the touch location that triggered the long press.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda