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

How to get the UIView object at the location of UITouch from - (void)touchesEnded:withEvent:?

I want to get the object at the location of where the touch is lifted (off the screen). This will be used to implement a drag-and-drop and I have these methods for overriding: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent…
0
votes
1 answer

Does implementing UIResponder touch methods inside a UIView subclass violate MVC?

The following UIResponder methods report raw touches on screen: - touchesBegan:withEvent: - touchesMoved:withEvent: - touchesEnded:withEvent: Recently I was playing with a UIView subclass that I wanted to be touch responsive. Initially I…
Woodstock
  • 22,184
  • 15
  • 80
  • 118
0
votes
1 answer

Make a firstResponder UIView by containing another firstResponder (a UITextView)

I have a UIView subclass (MyView) that contains a UITextView. I want MyView to use UITextView for all UIResponder methods like so: @implementation MyView - (BOOL)canBecomeFirstResponder { return _textView.canBecomeFirstResponder } -…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
0
votes
2 answers

The keyboard for the UITextField does not appear on first tap in Swift

I have created an action that changes the color of UITextField. But when I tap on the textfield it changes color but the keyboard does not appear. The keyboard appears only on second tap. Is this an issue of first responder? I'm new to Swift…
0
votes
1 answer

touchesBegan and touchesEnded not called on a UIButton

When I touch a UIButton, the touchesBegan, touchesMoved and touchesEnded methods are not called. I want to perform an event when a continuous touch happens and cancel the event when the touch ends.
Nazish Ali
  • 320
  • 3
  • 16
0
votes
1 answer

touchesEnded not getting called after device changes orientation

I am implementing touchesBegan and touchesEnded in my iOS application trying to detect when the user puts a finger on the screen and when he releases it. The problem I am having is that as soon as touchesBegan gets called, if the user rotates the…
Prientus
  • 733
  • 6
  • 15
0
votes
0 answers

Why doesn't UITextField tab to the next one when it has a UIViewController?

I have a UITableViewController whose cells contain UITextFields. I've noticed some very strange behavior that is confusing and difficult to address. When those UITextField objects are NOT managed by any UIViewControllers, using the Tab key on the…
Joey Carson
  • 2,973
  • 7
  • 36
  • 60
0
votes
1 answer

Automatically passing events from ChildViewController to parentViewController

I can't figure out how enable iOS to pass events from a childViewController down to its parentviewcontroller. My childviewcontroller is like an overlay it's root view is transparent and it's opaque views cover a dynamic area - potentially the the…
Jakob
  • 1,126
  • 3
  • 16
  • 38
0
votes
2 answers

UIView touchesEnded Event not called on first tap, but called if tap again

I have a UIView subclass named "MyView". In ControllerA, it has a property, MyView *myView, and added it to self.view. On myView, there are some random subviews sliding from right to left, and then disappears. What I want to do is, when the user tap…
longbow
  • 362
  • 2
  • 14
0
votes
1 answer

UIKeyCommands of custom UITableView not recognized

I have a UITableView subclass that has the keyCommands property implemented, where there are several UIKeyCommands provided. This UITableView is a subview of the main view in the View Controller. When I run the app and hold Command to preview the…
erdekhayser
  • 6,537
  • 2
  • 37
  • 69
0
votes
2 answers

Responder Chain but NOT delegate property passes value back to view controller from container

The following code should show two ways to pass information from an embedded controller (UICollectionView) back to a detailed view controller using either the Responder Chain OR delegate approach. Both approaches use the same protocol, and delegate…
DrWhat
  • 2,360
  • 5
  • 19
  • 33
0
votes
1 answer

setRightBarButtonItems:animated: crash

I called [self.navigationItem setRightBarButtonItems:nil animated:YES]; to hide the buttons during refresh operations Sometimes I caught an exception saying *** setObjectForKey: object cannot be nil (key: kUINavigationBarAnimationRightViews)
Tim
  • 1,877
  • 19
  • 27
0
votes
1 answer

Prevent parent view controller from receiving UITouch in child controller

So, in my app, then a map annotation is pressed, It reveals a modal view controller. Then when an element that modal controller is pressed, I open another, smaller controller. In both controllers, I have implemented the method -…
Minebomber
  • 1,209
  • 2
  • 12
  • 35
0
votes
3 answers

Show custom inputView/Keyboard by tapping on UIBarButtonItem

I’d like to show a custom date picker keyboard when tapping a Toolbar button (UIBarButtonItem). For showing custom keyboards using a a UIResponder’s inputView seems to be the right choice. Unfortunatelly the UIBarButtonItem isn’t a subclass of…
Bernd
  • 11,133
  • 11
  • 65
  • 98
0
votes
3 answers

iPhone: Handling touches transparently

I have a UIViewController and an associated with it UIView. The UIView has a number of subviews. How to handle touch event inside a specified rectangle in my UIViewController subclass? This handling should be transparent: UIView and its subviews…
alexey
  • 8,360
  • 14
  • 70
  • 102