uievent

Touch event handled by multiple views

主宰稳场 提交于 2019-12-31 22:25:26
问题 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 touch events to be handled both by the UIView subclass and the UITableView . How can I do that? Is it possible to have, ie, touchesMoved being triggered on the UIView subclass and then on UITableView ? Thank you so much for any help. 回答1: The way I

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

ぐ巨炮叔叔 提交于 2019-12-23 21:12:42
问题 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 error: Cannot invoke 'AnyObject' with no arguments How do I fix this? 回答1: In 1.2, touchesForView now returns a native Swift Set rather than an NSSet , and Set doesn't have an anyObject() method. It does have a first method, which is much the same thing. Note, also,

Identifying the Type of Touch Gestures from UIEvent Object

江枫思渺然 提交于 2019-12-21 04:11:04
问题 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 the type of remote events from the UIEvent subtype, and even if the device was shaken, but there is no parameter for touch events... How do you identify those? 回答1: You have to do touch analysis on your own. It is not that difficult, but it is not

UIGestureRecognizer receive touch but forward it to UIControl as well

◇◆丶佛笑我妖孽 提交于 2019-12-20 10:18:37
问题 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) and B (red) are both subviews of the same superview (gray). In other words, they are both siblings and the order decides on which of them covers the other. Option 1: View B (red) has a regular UIButton as its subview. Option 2: View A (blue) has a

UIEventSubtype missing elements

隐身守侯 提交于 2019-12-13 01:46:46
问题 The enum UIEventSubtype (iOS UIKit Framework) contains events such as play, pause, next, seek, etc. However, the iPod Access protocol contains numerous other events, such as select, up, down and back (think iPod with clickwheel). The iPod app on iOS can receive these other events and respond accordingly (move selection up/down/back in playlists), but developer apps don't have seem access to these controls. Does anyone know a way to receive these additional events in an iOS app (for jailbreak)

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

◇◆丶佛笑我妖孽 提交于 2019-12-11 15:56:55
问题 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 UIGestureRecognizer on MyView , and when does it get sent as a touchesBegan/touchesMoved/touchesEnded to MyView I have searched with all possible queries I could think of, and really only found a few decent sources, but nothing that answers exactly what I'm

Stacking UITableViews does not pass touch events beneath its view

ぃ、小莉子 提交于 2019-12-06 01:40:06
问题 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 /*code in rootView*/ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {} - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {} - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {} expecting that these functions

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

青春壹個敷衍的年華 提交于 2019-12-05 13:24:47
问题 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 "ViewController.h" #import <AVFoundation/AVFoundation.h> @interface ViewController () @property (nonatomic) AVAudioPlayer *player; @end @implementation ViewController @synthesize player; - (BOOL)canBecomeFirstResponder { return YES; } - (void)viewDidLoad {

Generating Remote Control Events from my app

ぐ巨炮叔叔 提交于 2019-12-05 06:22:56
问题 I have two questions regarding Remote Control Events on iOS: I know that music applications are registered to remote control events and then can receive such events from the iPhone's player widget. Let's say I want my app to fire such events, is that possible? How does headphones for example generate those events? 回答1: Without private API, you cannot send remotecontrol event to your application. The reason is we cannot create such an Event (UIEvent) to send out by using: [[UIApplication

Stacking UITableViews does not pass touch events beneath its view

半腔热情 提交于 2019-12-04 06:34:35
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 /*code in rootView*/ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {} - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {} - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {} expecting that these functions will be called when the top most view ie TableView is touched or moved,but on the contrary none of the