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
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…
4
votes
3 answers

iOS Responder Chain and Events

I'm a little confused. There are two UIViewControllers in UINavagationController's stack. I try to call the method of first UIViewController within the second UIViewController. See code below class VC1: UIViewController { @objc func method1()…
4
votes
1 answer

iOS // Skip song programmatically from any player

I'm trying to control the active music player from my app to skip the currently playing song. I'm able to do it for the iPod music player with MPMusicPlayerController *musicPlayer = [MPMusicPlayerController systemMusicPlayer]; [musicPlayer…
M to the K
  • 1,576
  • 3
  • 17
  • 27
4
votes
0 answers

When using hitTest:withEvent method - decide if tap was initiated

I'm trying to override hitTest:withEvent in a custom view. This is a container view with many subviews. Attached to this "superView" is a gesture recognizer. On top of this view sit many subviews (which in turn have more and more subviews) I decided…
Avba
  • 14,822
  • 20
  • 92
  • 192
4
votes
3 answers

How to send touch events to superview in iOS?

I am doing an iPad app. How do I send touch events to its superview? I am adding a view which is always some other activity. On that I am adding scrollview to half the screen and in the other half I add another view. It all works fine, now I…
Shankar BS
  • 8,394
  • 6
  • 41
  • 53
3
votes
1 answer

UIView hitTest:withEvent: and pointInside:withEvent

I'm working with Mixare AR SDK for iOS and I need to solve some bugs that happends, one of them is show the information of a POI when the POI's view is tapped. Prelude: Mixare has an overlay UIView within MarkerView views are placed, MarkerView…
Rotten
  • 742
  • 10
  • 24
3
votes
2 answers

How to catch and handle all events of UIButton in a single method?

I want to have a single method for all the buttons (and all their events) of a view. So far this is what I've got: - (IBAction)uibuttonEvent:(id)idSender forEvent:(UIEvent*)uieventHandle { if (idSender == [self uibuttonConnectInput]) { …
user1052016
3
votes
0 answers

Send UIEvent from iOS device UIView to external screen UIView

I'm working on an app using AirPlay and I need a way to have touches on the main screen act as touches on the UI on my external screen in order to be compatible with a large number of previously existing custom UI elements. Rebuilding the UI…
Kyle Olson
  • 116
  • 6
3
votes
1 answer

Custom UIControl always sends nil UIEvent objects

I have a class that derives from UIControl in which I monitor the touchesBegan/Moved/Ended/Cancelled events. Within those events I call the same events on both super and next responder like so: [self.nextResponder touchesEnded:touches…
leebert
  • 83
  • 1
  • 6
3
votes
0 answers

How to prevent my custom UIControl to pass touch event through underlying view

I create a custom UIControl, but when I tap on my control, touch event always passing through to superview. Here is my set up and sample project for this https://dl.dropboxusercontent.com/u/2271974/FunWithUIControl.zip View with tap gesture -…
sarunw
  • 8,036
  • 11
  • 48
  • 84
3
votes
2 answers

motionEnded method in Swift 2.0

I can't seem to get the motion detection methods to work with Swift 2.0/Xcode 7. The error I'm getting indicates: 'Method does not override any method from its superclass'. I want to detect various motions using the built in UIEvent methods.. i.e.…
Ryan Lake
  • 35
  • 4
3
votes
2 answers

event.touchesForView().AnyObject() not working in Xcode 6.3

This worked perfectly before: func doSomethingOnDrag(sender: UIButton, event: UIEvent) { let touch = event.touchesForView(sender).AnyObject() as UITouch let location = touch.locationInView(sender) } But in Xcode 6.3, I now get the…
Naftali Beder
  • 1,066
  • 1
  • 10
  • 27
3
votes
1 answer

UITouch returns UIWebBrowserView (Apple internal component) instead of UIWebView

I have a UIWebView and I want to detect any touch on that. (I don't want to use UITapGsture or any other thing) I am using sendEvent: method of UIApplication for this purpose and check if touch object contains webview. Surprisingly it points to…
Kunal Balani
  • 4,739
  • 4
  • 36
  • 73
3
votes
3 answers

Why is only one UIEvent created for many separate touches?

I'm learning the touch event mechanism of iOS. From the documentation I understood that a UIEvent object would be created when first touch down happened, it would live till the last touch up, and it would contain all the UITouch objects created in…
Suge
  • 2,808
  • 3
  • 48
  • 79
3
votes
1 answer

Smaller active area for circle shaped Custom button

I have a custom button (which uses a a circled shaped image as its custom view). The problem is: the active area of the custom button is much too large, if I tap at least 100 pixels outside the button, it still gets registered as a tap on the…
user1288005
  • 890
  • 2
  • 16
  • 36