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

120 questions
1
vote
1 answer

Copy UIEvent object in touchesBegan Method

I'm trying to pass the UIEvent object received by touchesBegan method to other objects that have to extract the touches from this event to do things. The problem is when the first responder receives the event in the first call to touchesBegan and…
NemeSys
  • 555
  • 1
  • 10
  • 28
1
vote
1 answer

How to type scroll event in React?

Tell me how to correctly type the scrollHandler function in this case. ` useEffect(() => { document.addEventListener('submit', scrollHandler); return () => document.removeEventListener('scroll', scrollHandler) }) const scrollHandler = (e:…
ko1p
  • 37
  • 3
1
vote
1 answer

Intercept UIControlEventTouchUpInside in hitTest:withEvent:

I have followed this great tutorial and I finally managed to implement a 3 independent rows scrollable interface. I am left with a problem though, as the key of that tutorial is the use of method: - (UIView *)hitTest:(CGPoint)point…
Fabrizio Prosperi
  • 1,398
  • 4
  • 18
  • 32
1
vote
1 answer

Receiving UI events in C++ classes

I'm writing Objective-C++ in Xcode for iOS. My project is mostly C++ classes and a few Objective-C classes at the highest level. My C++ classes contain Objective-C UI elements and I need them to receive UI events. Is it possible for a UI element to…
Luke
  • 7,110
  • 6
  • 45
  • 74
1
vote
0 answers

Re-issuing a touch event

I'm trying to create an overlay view that monitors for touches and then disappears, but also forwards touch events to whatever is underneath the view. My test app has a view with a button inside. I add the overlay view as another subview (sibling to…
Karl
  • 14,434
  • 9
  • 44
  • 61
1
vote
0 answers

Order of UIGestureRecognizer touchesBegan(_:with:) and point(inside:with:)

The Question When the user taps on a view which of these two functions is called first? touchesBegan(_:with:) or point(inside:with:). The Context I want to subclass a PKCanvasView (which inherits from UIScrollView) to allow interaction through the…
santi.gs
  • 514
  • 3
  • 15
1
vote
0 answers

When overriding pressesBegan, etc., on iOS, how to handle multiple presses?

When overriding pressesBegan:withEvent on iOS to handle hardware keyboard events, it passes in an NSSet of UIPress objects, and a single UIEvent object. When I have decided which of the presses I wish to handle, do I then call [super…
Gregatar
  • 33
  • 4
1
vote
1 answer

UIResponder Chain Explanation Needed

I'm having trouble getting my UIButtons, UIScrollViews etc working in this situation: I have the base UIViewController, which is the root controller of the UIWindow. Above that layer I have some other UIViews added, which I will call the "Middle…
Rich Brooks
  • 521
  • 1
  • 6
  • 17
1
vote
1 answer

When do "finger" events get sent as Gestures to UIGestureRecognizer vs touchesBegan/touchesMoved/touchesEnded to UIView

I come from macOS/Cocoa & Mouse Events, and I'm trying to get a hang of these "Finger"(my own name for it) events My question is: When a "Finger" event is happening on a UIView (let's call MyView), when does it get sent as a Gesture to a…
A O
  • 5,516
  • 3
  • 33
  • 68
1
vote
0 answers

Why is my app not responding to remote control events?

I'm making an app that plays an audio stream on the background when the device is locked. I want the app to respond to the media controls on the lock screen. I followed this answer but for some reason I can't make my app respond to these controls.…
Marilyn García
  • 105
  • 1
  • 13
1
vote
0 answers

Lifting 2/2 Fingers off a UIView vs. lifting just 1/2

When the user has 2 fingers on a UIView and lifts both simultaneously this code will determine event.touches(for: self).count to be 2. override func touchesEnded(_ touches: Set, with event: UIEvent?) { print(event?.touches(for:…
Marmelador
  • 947
  • 7
  • 27
1
vote
1 answer

Getting a vector from a touch location in swift 3

As the title says, how can I accomplish this? I can get the first touch but I don't know how to get the last touch if it is a swiping gesture. With the following code I get the error: value of type 'Set' has no member 'last'. Not really sure how to…
Lyres
  • 343
  • 4
  • 14
1
vote
1 answer

what does it mean when it said "an event couldn't be handled"?

I am reading through the documentation of UIResponder class and I came across the responder chain. Now it's said that for example, when a hit-test can't handle an event, it passes it up a chain of responders. So, what example can clarify how an…
Badr
  • 694
  • 1
  • 7
  • 26
1
vote
1 answer

GPUImage does not update when MotionShake detected

I have a fuction, which after a shake, resets all sliders to their defaults and calls -proccesImage after the slider's value has been changed. The problem is that each of the sliders do, in fact, get reset to the default positions but GPUImage does…
Casper
  • 265
  • 4
  • 12
1
vote
2 answers

setTimeout and UIEvent order

If a bunch of UIEvents are queued up because of some long-running method in a script, and at the end of the method I setTimeout(myfunc, 0), what order will myfunc get called in relative to handlers for the previously queued events? Is it guaranteed…
Andy
  • 7,885
  • 5
  • 55
  • 61