Questions tagged [uievent]

fA UIEvent object (or, simply, an event object) represents an event in iOS. There are three general types of event: touch events, motion events, and remote-control events. It is declared in UIKit framework. It is available in iOS 2.0 and later

A UIEvent object representing a touch event is persistent throughout a multi-touch sequence. UIKit reuses the same UIEvent instance for every event delivered to the application.

You can obtain event types and subtypes from the type and subtype properties. UIEvent defines event types for touch, motion, and remote-control events. It also defines a motion subtype for "shake” events and a series of subtype constants for remote-control events, such as “play” and “previous track.” The first responder or any responder in the responder chain implements the motion-related methods of UIResponder (such as motionBegan:withEvent:) to handle shaking-motion events. To handle remote-control events, a responder object must implement the remoteControlReceivedWithEvent: method of UIResponder.

The touchesForGestureRecognizer: method, which was introduced in iOS 3.2, allows you to query a gesture-recognizer object (an instance of a subclass of UIGestureRecognizer) for the touches it is currently handling.

Source: UIEvent Class Reference

Related SO questions:

UIGestureRecognizer receive touch but forward it to UIControl as well

App crash on sendEvent method

119 questions
36
votes
1 answer

UIGestureRecognizer receive touch but forward it to UIControl as well

How would you allow a UIGestureRecognizer of a UIView to receive a touch event but also make sure that another, underlaying/overlaying UIView also receives that very same touch event? Lets say I have got the following view-hierachie: Views A (blue)…
Till
  • 27,364
  • 13
  • 84
  • 120
17
votes
2 answers

Why do the Lock Screen audio controls disappear when I pause AVAudioPlayer?

I'm using an instance of AVAudioPlayer to play an audio file. The app is configured to play audio in the background and an appropriate audio session is set. I am also successfully receiving remote control events. Here's the code: #import…
maml
  • 584
  • 3
  • 11
10
votes
3 answers

Identifying the Type of Touch Gestures from UIEvent Object

Is there a way to gain the type of touch gestures that triggered a UIEvent? So, let's say I intercept a gesture with hitTest:withEvent:. How do I identify what kind of touch (pinch, tap, swipe, etc.) happened that triggered this method? I can gain…
user1799795
  • 259
  • 4
  • 11
9
votes
3 answers

Touch event handled by multiple views

I have a subclass of UIView on top of a UITableView. I am using the UITableView to display some data and, at the same time, I would like to overlay an animation that follows the finger (for instance, leaving a trail). If I get it right, I need the…
ios-lizard
  • 816
  • 1
  • 12
  • 18
9
votes
3 answers

How can we handle headphone play/pause button events in foreground in ios

I have an requirement that to handle headphone play/pause button events in foreground. How ever I am able to handle the same scenario in background using the below code if ([[UIApplication sharedApplication]…
Santosh Gurram
  • 987
  • 3
  • 12
  • 22
8
votes
3 answers

iOS Loses Touches?

I can't find anything to explain lost UITouch events. If you smash your full hand on the screen enough times, the number of touchesBegan will be different than the number of touchesEnded! I think the only way to actually know about these orphaned…
Joe Beuckman
  • 2,084
  • 1
  • 21
  • 58
8
votes
3 answers

Getting touches at launch on iOS

On Mac, one can always get the location of the mouse "outside the event stream" (ie, even if you've not subscribed to any delegate methods for mouseUp: et al) by calling [NSEvent mouseLocation]. Is there any way on iOS to get current touch events…
SG1
  • 2,771
  • 1
  • 26
  • 41
7
votes
1 answer

App crash on sendEvent method

When I rotate the app twice after selecting a few items, it crashes. I have overridden the sendEvent method and that's where the debugger stops. When I try to print the event type, it shows me something weird (I think it's a memory location that…
Anthony De Smet
  • 1,867
  • 3
  • 12
  • 21
7
votes
3 answers

iOS - childViewController not receiving events

Newest Update: I created a brand new project that is built the exact same way as below. However, this test project actually works just fine even though it seems to be the same... One thing I've noticed is that the parent view controller in the…
6
votes
2 answers

Stacking UITableViews does not pass touch events beneath its view

I am having 3 UIViews stacked one on top of another UITableview planeView rootView TableView is at the top and rootView at the bottom. (rootView is not visible as TableView is on top of it) I have implemented the following code in rootView …
prajul
  • 1,196
  • 2
  • 14
  • 27
5
votes
0 answers

Manually run IOS UIEvent loop

I am working on a project where I want to manually run the main event loop on IOS. That is to say, I want to dequeue the UIEvents myself from the source, and then send them on to the UIApplication. I have found examples on how to do this for OS X,…
jujumbura
  • 295
  • 1
  • 8
5
votes
1 answer

Preventing MKMapView changing selection (cleanly)

I have a custom subclass of MKPinAnnotationView that displays a custom call out. I want to handle touch events inside that annotation. I have a working solution (below) but it just doesn't feel right. I have a rule of thumb that whenever I use…
Rog
  • 16,650
  • 9
  • 48
  • 73
5
votes
0 answers

iOS: How to make one view controller mirror another's actions

I'm trying to "mirror" a view controller: app instantiates view controller 1 (of class A) app instantiates view controller 2 (also of class A) on another UIWindow (external display, via Airplay or physical connector) any touch event that view…
5
votes
2 answers

UIEventSubtypeRemoteControlTogglePlayPause not doing anything

I have an application that plays music and want to use lockscreen control (play/pause). With NSLog I can see that my app get's the button trigger but not theUIEventSubtypeRemoteControlTogglePlayPause. Here's a bit of my code: - (void)viewDidLoad { …
ASCJU
  • 317
  • 3
  • 13
5
votes
2 answers

how to make iOS 7 UIScrollView suppress touch events on embedded UIView

Think of a UIScrollView with embedded (subview) UIViews, arranged in a column. In iOS6 and previously, the scroll view could be configured so that when you flick it with your finger, the embedded views do not receive touch events even if the initial…
1
2 3 4 5 6 7 8