uievent

Generating Remote Control Events from my app

浪子不回头ぞ 提交于 2019-12-03 21:42:15
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? 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 sharedApplication] sendEvent:anEvent]; You can, however save a registered event then play back by calling the

Identifying the Type of Touch Gestures from UIEvent Object

*爱你&永不变心* 提交于 2019-12-03 12:50:10
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? You have to do touch analysis on your own. It is not that difficult, but it is not done for you. Here a sample from some code I am actually using. It is not meant as a full-scale solution. It

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

纵饮孤独 提交于 2019-12-03 12:47:22
问题 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] respondsToSelector:@selector(beginReceivingRemoteControlEvents)]){ [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL]; [self becomeFirstResponder]; NSLog(@"Responds!"); } Please help with

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

落花浮王杯 提交于 2019-12-03 04:04:09
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] respondsToSelector:@selector(beginReceivingRemoteControlEvents)]){ [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL]; [self becomeFirstResponder]; NSLog(@"Responds!"); } Please help with an explanation or sample code if possible. I have done lots of research but no help. There is another

Touch event handled by multiple views

China☆狼群 提交于 2019-12-03 03:03:43
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. The way I have solved this problem is in a way that is not that clean, but it works. Please let me know if there's a

UIGestureRecognizer receive touch but forward it to UIControl as well

怎甘沉沦 提交于 2019-12-02 21:48:36
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 regular UIButton as its subview. Given Option 1 for the sake of explanations: View A (blue) has a

How to send touch events to superview in iOS?

a 夏天 提交于 2019-11-29 15:41:47
问题 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 want to add a button and a small description view that will appear when button is tapped and disappear again when button is tapped again. In order to implement this I took a view which covers the entire view and made its back ground color clear. I place