user523234
user523234

Reputation: 14834

Detect the first user interaction (touches, press, tap, pan, pinch, etc.) after app starts

Is there a way to detect the first user interaction right after app starts?

I have an app that on the main view it has a navigation bar with 5 buttons, a top half with scroll view and a bottom half with another scroll view. When app starts, I have an animation of a series of images going on the top half. And as soon as user touch, press, tap any buttons, or any where, I need the animation to stop.

I can make the buttons, top half scroll view and bottom half scroll view to post a notification so my observer can handle the stopping of the animation. But I just thought there is a better way to do this?

Upvotes: 0

Views: 347

Answers (1)

gurooj
gurooj

Reputation: 2110

Yes, there are touch delegate methods, such as - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event, (void)touchesMoved:(NSSet *)touches</span> withEvent:(UIEvent *)event, and (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event. Put these in the view controller of whatever screen appears first. And you can handle touch events. Note you will have to set objects, or views to [view setUserInteractionEnabled:YES] or something like that in order to receive touch events.

Upvotes: 1

Related Questions