user1786570
user1786570

Reputation: 23

iOS is there a limit to duration of touchesbegan?

I'd like to do several things in my app after the user has touched - the longer they touch, the better - is there a limit? Will iOS 'force' a touchesEnded after too long?

Upvotes: 1

Views: 143

Answers (2)

Rok Jarc
Rok Jarc

Reputation: 18875

touchesEnded will be called when touch(es) end. You can (theoretically) take as much time as you want in touchesBegan handler. But that can (and probably will) result in bad UI responsiveness.

If you really need to do something that takes a lot of time you might want to consider starting a background thread in touchesBegan.

If memory serves me right touchesMoved will only be called when touchesBegan method reaches the end - touches will be buffered though.

EDIT: as for your updated question: no, there is no limit to this besides the battery and users patience. Depends on what you want to achieve there might be a more elegant solution than staying in touchesBegan.

Upvotes: 0

Alfie Hanssen
Alfie Hanssen

Reputation: 17104

There's likely no limit. The constraint it probably more a user experience one (at what point might a long press become annoying).

Upvotes: 1

Related Questions