-6

I need to implement an Idle Time Out feature. To do that I simply need to know how to detect when the user touches the screen (something similar to onUserInteraction method used in Android).

So how can I simply discover when the user interacts with the ViewController?

P.S: if I ask this it is because you can't find nothing good in the internet!

ernestocattaneo
  • 1,197
  • 5
  • 18
  • 30
  • 2
    Just do that: http://stackoverflow.com/questions/26001574/how-to-detect-user-inactivity-since-last-touch-on-a-particular-viewcontroller-in – klefevre Dec 23 '14 at 13:11

1 Answers1

1

My take is that you need to catch the event when user touches a screen. Method: touchesBegan:withEvent

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

  for touch in touches {

  // get the time measurement
  // compare it to previous one for time difference


  }

}

Here, Arthur Knopper has a tutorial, you may find useful: http://www.ioscreator.com/tutorials/drawing-circles-uitouch-ios8-swift

thinkswift
  • 528
  • 1
  • 5
  • 15