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
2 answers

UITextField unable to become first responder if added to UITableViewCell via accessoryView

Like many other users, I'm trying to set throw a UITextField into a UITableViewCell to be used for editing a row. But instead of adding a new view, I'm trying to use the accessoryView property. At first I tried this... - (void)tableView:(UITableView…
rob5408
  • 2,972
  • 2
  • 40
  • 53
0
votes
2 answers

Sibling subview does not receive touches in iPhone

I have a view (parent) with two subviews, one on top (topChild) of the other (bottomChild). If I tap on the screen only topChild and parent receive the touch event. What should I change to propagate the touch event to bottomChild as well? The…
hpique
  • 119,096
  • 131
  • 338
  • 476
0
votes
1 answer

shake detection in iPhone which is presented as ModalViewController from appdelegete?

although this is a answered question here. the solution works fine in rootviewcontroller of the appdelegate. if same methods are written in a viewcontroller which is presented as a modalviewcontroller from the app delegate it doesn't work :(. can…
0
votes
0 answers

How to change and apply the responder?

screenshot I am studying the Instagram profile view. What I want is a way to pass the touch event that occurs in the collectionview to the scrollview. I want to use the default scroll of scrollview. Because for smooth scrolling I think it should be…
jkey
  • 3
  • 2
0
votes
1 answer

UIViewController's canPerformAction is called multiple times with the same action and sender

I'm trying to understand in depth how UIResponder actually works under the hood. But there's one thing that I don't catch. Why canPerformAction invokes multiple times even after returning true. p.s. I pass nil here on purpose button.addTarget(nil,…
Nikita Ermolenko
  • 2,139
  • 2
  • 19
  • 41
0
votes
1 answer

Event Delegation like in JavaScript, but in iOS Swift

Is there a way in Swift to capture events on a screen similar to how Event Delegation in JavaScript works? I would like to find a way to respond to events without having to embed logging calls to each method. I believe UIResponder might have this…
joenotjoe
  • 11
  • 4
0
votes
0 answers

Catch what user tapped (Textview1 or Textview2 or Button1) when keyboardDidShow (via NSNotification)

I would like to intercept what button/textview or #tag the user tapped when I reach the func keyboardDidShow @objc func keyboardDidShow(notification: NSNotification) { guard let userInfo = notification.userInfo else {return} …
Victor
  • 61
  • 1
  • 13
0
votes
1 answer

How can I put UIResponder prior to Gesturer Recognizer

What I was trying to do is let user select a row and retrieve cell content within it in another text field to edit at the same time by recognize long press rather than single click. The problem is long press recognizer proceeds prior to table view's…
Alan Hoo
  • 445
  • 3
  • 12
0
votes
2 answers

What is first responder?

According to Apple's documentation: When your app receives an event, UIKit automatically directs that event to the most appropriate responder object, known as the first responder. Same documentation explain how first responder is determined: The…
Artium
  • 5,147
  • 8
  • 39
  • 60
0
votes
0 answers

Swift 5 UIView has no UIResponder

Here is the sample source code: ViewController: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view = Home() } } Home class Home: UIView { ... func parent() ->…
hanabi_noir
  • 197
  • 1
  • 1
  • 15
0
votes
1 answer

UIResponder: keyCommands not called; confirmed isFirstResponder

My app has a passcode view, conceptually similar to the iOS unlock screen. It's a UIViewController that I present within a new UIWindow. Works fine. I'm adding the capability to type the passcode using a hardware keyboard. The keyCommands method…
Mitch Cohen
  • 1,551
  • 3
  • 15
  • 29
0
votes
1 answer

UIResponder chain not working in UIButton action

I have a uibutton in child view controller that its action needs to be called in parent view controller. this is my code class ChildViewController: UIViewController { @IBOutlet weak var btn: UIButton! override func viewDidLoad() { …
0
votes
1 answer

Another problem with UIResponder and event delivery

I'm trying to implement a UIResponder object that will allow me to record screen activity, then pass the event on to the next responder to allow the application to proceed as normal. I've been researching this for a while now and see two ways that…
0
votes
3 answers

Change the FirstResponder

Hola guys. I'm experiencing a little problem with touch handling and UIResponder. My goal is to manage a single touch (moved) to interact with different views. I added a gesture recognizer to my UIImageView that send a simple message to my…
Gabriele
  • 1,163
  • 1
  • 11
  • 24
0
votes
1 answer

Moving keyboard when editing multiple textfields with constraints swift

I have UIViewController which looks like this: I set all the relevant constraints. I'm trying to shift the UIView up when the keyboard shows up - when I click on the UITextfields below. I have the following code: static func…
Idanis
  • 1,918
  • 6
  • 38
  • 69