Questions tagged [responder-chain]
43 questions
1
vote
0 answers
event touchesForView: returns null in super view
I have a subclass of UIView called BigView that overrides touchesMoved (among other things) like so:
@implementation BigView
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet * viewTouches = [event touchesForView:self];
…

Gregor
- 585
- 8
- 19
1
vote
2 answers
UIResponder chain produces two extra responders
I'm running Xcode 14.0 beta 4. I have just one ViewController with a root view in storyboard. I want to see an entire Responder Chain from UIView to AppDelegate. To do this, I created extensions:
import UIKit
extension AppDelegate {
override…

Andy Jazz
- 49,178
- 17
- 136
- 220
1
vote
1 answer
Responder chain error
I want to translate this kind of Objective-C code to Swift:
- (UINavigationController *)targetNaviCtrl{
if(!_targetNaviCtrl){
UIResponder *target = self.nextResponder;
do {
target = target.nextResponder;
}…

dengApro
- 3,848
- 2
- 27
- 41
1
vote
1 answer
Is it good App design to use first responder instead of chaining methods down the controller hierarchy?
This question is for an OSX app, but the same principle can be for iOS.
I have a NSWindowController on storyboard with the following setup.
A. MainWindowController has as subviews:
1) A toolbar with a button
2) A SubVcA viewController with its own…

Just a coder
- 15,480
- 16
- 85
- 138
1
vote
2 answers
mouseDragged: is not passed down two subviews?
I am writing a program that has a number of subclassed NSViews (Frame) with varying contents that can be dragged around by the mouse in their superview. All of the views contain one subview, called contentView, which in turn can contain a more…

Klaus Boldt
- 63
- 1
- 8
0
votes
1 answer
tryToPerform:with: not being called when keyDown: is being called
I have a NSViewController which I manually put into the responder-chain by calling
self.nextResponder = self.view.nextResponder;
self.view.nextResponder = self;
When the user presses keys inside the view, I am able to successfully receive keyDown:…

Tony
- 36,591
- 10
- 48
- 83
0
votes
1 answer
Using the responder chain to see when a subview is added
It there any way for a window to tell that a subview's subview has been added. It seems like there is architecture in place (in the form of the responder chain) to allow a kind of event bubbling up the view hierachy, but this only seems to exist to…

Undistraction
- 42,754
- 56
- 195
- 331
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
configure tap gesture recognizer to also respond to ibactions at the tap location
I have a message chat box similar to most chat apps. The box goes up when when you start editing the messagetextView.
As is standard, there is a tap gesture recognizer that is called when the user taps anywhere else, which dismisses the…

Tim Hirsch
- 7
- 3
0
votes
1 answer
Why doesn't my UILabel in a nested view receive touch events / How can I test the Responder Chain?
I have found lots of similar questions about not receiving touch events and I understand that in some cases, writing a custom hitTest function may be required - but I also read that the responder chain will traverse views and viewControllers that…

Jim
- 55
- 1
- 7
0
votes
0 answers
What is the proper design pattern for handling keyDown: events in a NSSplitView?
I would like to have separate KeyDown: handlers for each of the various subviews in a complex splitview based Window. In addition, I would like to have a "global" KeyDown: handler at the WindowController level for any keys that are not handled by…

bgdegazio
- 19
- 5
0
votes
2 answers
IBAction does not fire when I add viewDidLoad
I have several IBActions attached to UIButtons. The IBActions work fine until I add the following code:
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"View Did Load");
[self addGestureRecognizersToView:drawImage];
}
After I add…

AaronG
- 532
- 1
- 7
- 18
0
votes
0 answers
How to make a custom NSView IBActions callable from menu items?
I have a NSViewController that adds a custom NSView as a subview to the view controllers view. I would like to make the IBAction-methods of that custom view callable thru the First Responder object but the menu items that are wired to the…

Melodius
- 2,505
- 3
- 22
- 37
0
votes
1 answer
iOS: How to implement the mask view event penetrate?
As the following image,I have a collectionView, with a maskView above it.
And a right side view above the maskView.
How to implement the mask view event penetrate?
My PM's idea is that the collectionViewCell is clickable when a mask view above the…

dengST30
- 3,643
- 24
- 25
0
votes
1 answer
UIButton do not respond to touch event
I have a UIButton not responding to touch event. And the button only has some subviews not handling events. So I replaced it with my customized UIButton to find out what happened. Below is my code:
@interface CustomButton :…

Neal.Marlin
- 494
- 5
- 17