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
0
votes
1 answer

Swift: Haptic effects for grid of UIButtons

I have a grid of UIButtons and I'd like to call a haptic effect for the following methods: When the user moves their finger over a button for the first time When the user lifts their finger (a typical tap, .touchUpInside works perfectly) Any…
user11145365
  • 184
  • 9
0
votes
1 answer

Make sibling view ignore any touch input, the other sibling view should receive it

I develop a Calendar library similar to the default iOS Calendar app, Day View (agenda). The calendar displays events which are subclasses of the UIView. The events can be tapped, long-pressed or could handle other gesture-based user…
Richard Topchii
  • 7,075
  • 8
  • 48
  • 115
0
votes
1 answer

iOS: How to implement the mask view event penetrate?

As the following image,I have a collectionView, with a maskView above it. And a right side view above the maskView. How to implement the mask view event penetrate? My PM's idea is that the collectionViewCell is clickable when a mask view above the…
dengST30
  • 3,643
  • 24
  • 25
0
votes
0 answers

How can I copy an UIEvent object to a local data structure?

Here a piece of code: import UIKit import RxCocoa import RxSwift import FTPopOverMenu_Swift public let popoverShowLists: PublishSubject<([List], UIEvent?)> = PublishSubject<([List], UIEvent?)>() private func setupPopoverShowList() { …
0
votes
1 answer

Get the last touch event on UIView

Note: This is a question similar to what is asked here, but the answer provided there is not exactly a solution in my case. The question's objective is different too. Reference: touchesBegan - Only needs the last touch action - iPhone I am…
Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70
0
votes
1 answer

Capturing and recording touch events on UIView

I'm trying to subclass UIView and design a transparent view. This view will sit on top of many other views and it's only task is to capture and record user touches (tap and pan). I have tried many different methods, explained in different questions…
0
votes
0 answers

Persist Set & UIEvent Objects in Swift (Using NSUserDefaults)

When I try to save an UIEvent-Object in NSUserDefaults, the app crashed with an error if i assign a UIEvent object. Why? Is it possible to save an UIEvent with NSUserDefaults? Here is my code: extension UserDefaults { // UIEvent func…
OnurYoruk
  • 1
  • 3
0
votes
1 answer

Subclass UIEvent to embed additional information?

Is it possible to subclass UIEvent to embed some additional information? I tried but keep getting exceptions and can't find anything about subclassing UIEvent. class CustomEvent: UIEvent { let payload: CustomData override init(payload:…
MH175
  • 2,234
  • 1
  • 19
  • 35
0
votes
1 answer

Apply impulse to a SKSpriteNode from a user swipe

Can anyone tell me why when I try to apply an impulse to a node like this it disappears? override func touchesBegan(_ touches: Set, with event: UIEvent?) { let touch:UITouch = touches.first! as UITouch startPoint =…
Lyres
  • 343
  • 4
  • 14
0
votes
1 answer

Detecting shake gesture by multiple view controllers

I need to detect shake gesture in iOS. I have done the usual stuff and it works perfectly fine. The thing is I have multiple view controllers in UITabBarController and I wish each of them to detect the shake gesture. When shaking in any of the view…
May Rest in Peace
  • 2,070
  • 2
  • 20
  • 34
0
votes
3 answers

How to respond to touches when the view is already pressed?

I have two views in a ViewController that perform specific actions when touched down. If I keep one of them pressed with one finger and touch the same view with another finger, nothing happens. The "ok" test below doesn't appear. I override the…
msampaio
  • 3,394
  • 6
  • 33
  • 53
0
votes
0 answers

forwarding UISwipeGestureRecognizer to underlying UIScrollView

in my viewController I have an imageSlider which is above a UITableView. I want to forward vertical swipeGesture from imageSlider to the underlying tableview. so when I swipe vertically on imageSlider, underlying tableView begins to scrolling.…
Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75
0
votes
1 answer

UITouch / UIEvent - delaying the event?

Is there any way to delay the event of this touchBegan function? - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *followTouch = [[event allTouches] anyObject]; bull.center = [followTouch…
Cody Taylor
  • 31
  • 1
  • 8
0
votes
1 answer

Distinguish between headset remote and Control Center music controls?

Simple question really: is there a way to tell whether a user double-tapped their headset remote to skip a track, or whether they pushed the skip button in Control Center, for example? I realise they both use the RemoteControl UIEvent, but I’m…
Luke
  • 9,512
  • 15
  • 82
  • 146
0
votes
2 answers

Time between 2 events

I haven't been programming in iOS for long but I was just wondering if anyone could help. I have a IBAction function and every time it is pressed increases a counter so I can see how many times it's been pressed. But I want to add functionality so…
DonnellyOverflow
  • 3,981
  • 6
  • 27
  • 39