Questions tagged [uiresponder]

The UIResponder class defines an interface for objects that respond to and handle events. It is the superclass of UIApplication, UIView and its subclasses (which include UIWindow). Instances of these classes are sometimes referred to as responder objects or, simply, responders.

The UIResponder class defines an interface for objects that respond to and handle events. It is the superclass of UIApplication, UIView and its subclasses (which include UIWindow). Instances of these classes are sometimes referred to as responder objects or, simply, responders.

There are two general kinds of events: touch events and motion events. The primary event-handling methods for touches are touchesBegan:withEvent:, touchesMoved:withEvent:, touchesEnded:withEvent:, and touchesCancelled:withEvent:. The parameters of these methods associate touches with their events—especially touches that are new or have changed—and thus allow responder objects to track and handle the touches as the delivered events progress through the phases of a multi-touch sequence. Any time a finger touches the screen, is dragged on the screen, or lifts from the screen, a UIEvent object is generated. The event object contains UITouch objects for all fingers on the screen or just lifted from it.

iOS 3.0 introduced system capabilities for generating motion events, specifically the motion of shaking the device. The event-handling methods for these kinds of events are motionBegan:withEvent:, motionEnded:withEvent:, and motionCancelled:withEvent:. Additionally for iOS 3.0, the canPerformAction:withSender: method allows responders to validate commands in the user interface while the undoManager property returns the nearest NSUndoManager object in the responder chain.

In iOS 4.0, UIResponder added the remoteControlReceivedWithEvent: method for handling remote-control events.

259 questions
15
votes
4 answers

Detecting continuous key presses with UIKeyCommand

Is it possible to get continuous key presses? I'm using keyCommands: to intercept the arrows keys being pressed on an external keyboard, but I only get 1 call per press. I would love to get either multiple calls every X milliseconds as long as the…
13
votes
2 answers

iPhone: Click view behind transparent UIScrollView

I have a UIScrollView that is set to have a clear background. Part of the scrollview does have content, but part does not (so it shows other views behind it). I would like to be able to click through the UIScrollView and to the MKMapView behind,…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
13
votes
5 answers

UITableViewCell skipped in responder chain

I'm attempting to trigger an event in a subview of a UITableViewCell, and let it bubble up the responder chain and be handled by a custom UITableViewCell subclass. Basically: SomeView.m (which is a subview of the UITableViewCell) [self.button…
Keith Norman
  • 505
  • 4
  • 11
12
votes
2 answers

Passing touch events to appropriate sibling UIViews

I'm trying to handle touch events with touchesBegan in an overlay to a parent UIView but also allow the touch input to pass through to sibling UIViews underneath. I expected there would be some straight-forward way to process a touch event and then…
Joey
  • 7,537
  • 12
  • 52
  • 104
11
votes
2 answers

Detect touch location on UIScrollView ?

I would like to detect the (initial) touch position in my UIScrollView when the user starts dragging. I have googled this issue and many seem to struggle with this very issue. Now, while I still can't wrap my head around why Apple would not let…
the_critic
  • 12,720
  • 19
  • 67
  • 115
10
votes
3 answers

keyboardWillShow called twice

I have a view with keyboard notifications such as keyboardWillShow and keyboardWillHide All the codes handles with the notification I use is taken from Apple's sample code "KeyboardAccessory" When I first enter this view, everything works fine. But…
Wang Liang
  • 941
  • 2
  • 15
  • 34
10
votes
1 answer

react-native change responder dynamically

I am using react-native for Android development. I have a view on which if user does long-press, I want to show an Animated View which can be dragged. I could achieve this using PanResponder, which works fine. But what I want to do is when user…
Abhay
  • 483
  • 4
  • 12
10
votes
3 answers

How do I redeclare a property as read-write in UIResponder subclass with swift?

I'm trying to follow this guide, but using swift: InputAccessoryView docked at bottom I can't seem to set the inputAccessoryView for my ViewController, according to the documentation, I need to redeclare it: The value of this read-only property is…
Dave
  • 193
  • 8
9
votes
5 answers

Touches began in UITableViewController

I am defining this method in my UITableViewController subclass: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; NSLog(@"touch began"); } but it's not being triggered.…
9
votes
2 answers

how does UIGestureRecognizer works with UIResponder chain?

I know that touch events can delivery to hit-view or gesture. but something confused me in my demo: I have two subviews in my root view, one is testView (subclass of UIView), the other is testBtn(UIButton) which action is "testBtnClicked". Then, I…
foolishBoy
  • 331
  • 1
  • 12
9
votes
3 answers

motionBegan:withEvent: not called in AppDelegate in iOS 10

I used to detect a shake motion from the AppDelegate by simply implementing this method: - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { NSLog(@"shake shake shake"); } which works fine in iOS 8 and 9. However it doesn't…
almas
  • 7,090
  • 7
  • 33
  • 49
9
votes
2 answers

UIViewController with inputAccessoryView is not deallocated

I have simple subclass of UIViewController (code below). If I attach inputAccessoryView, my viewcontroller is never deallocated. If I do not set inputAccessoryView in viewDidLoad, dealloc is called as expected. Am I missing something? @interface…
hybridcattt
  • 3,001
  • 20
  • 37
9
votes
1 answer

SpriteKit SKScene missing touchesEnded

I've noticed that touchesEnded don't always get delivered to an SKScene on multi touch. Depending on speed of removing fingers etc, I would permanently miss some of the touchesEnded. touchesCancelled is implemented and I added a custom UIView and…
Nuoji
  • 3,438
  • 2
  • 21
  • 35
9
votes
2 answers

UIToolbar standard sizes

What are the standard sizes of a UIToolbar for the following: iPhone/iPod iPhone 3.5 inch vertical iPhone 3.5 inch horizontal iPhone 4 inch vertical iPhone 4 inch horizontal iPad iPad vertical iPad horizontal
Jasper Blues
  • 28,258
  • 22
  • 102
  • 185
8
votes
1 answer

Understanding system logic for first responder

I'm confused about severals first responder points: If I call - becomeFirstResponder, does system call – canBecomeFirstResponder first? Why? Why are there both - becomeFirstResponder and – canBecomeFirstResponder? In what situations they can return…
user500
  • 4,519
  • 6
  • 43
  • 56
1
2
3
17 18