responder-chain

Determine if responder chain will handle an action

倖福魔咒の 提交于 2019-12-23 13:22:39
问题 The responder chain is cool. Particularly, being able to send custom actions to the first responder that will bubble up to anyone else that might be interested: [[UIApplication sharedApplication] sendAction: @selector(commandToSend) to: nil from: self forEvent: nil] . Or less custom actions with: [[UIApplication sharedApplication] sendAction: @selector(resignFirstResponder) to: nil from: self forEvent: nil] I'd like to know – is there a way to test before hand if a particular action from a

Cocoa: Forward actions (copy:, paste: etc.) up to the responder chain

时光总嘲笑我的痴心妄想 提交于 2019-12-12 16:26:46
问题 I have a subclass of NSOutlineView that implements copy: , paste: , cut: etc. Also, the NSDocument subclass implements these same methods. When the outline view is in the responder chain (is first responder or a parent view of it), all copy/paste events are intercepted by the NSOutlineView subclass. What I want, is depending on the context catch some of these messages, or let them propagate and be caught by the NSDocument subclass. What I want is basically: - (void)copy:(id)sender { // If

UITableViewCell skipped in responder chain

怎甘沉沦 提交于 2019-11-30 03:52:25
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 addTarget:nil action:@selector(someAction:) events:UIControlEventTouchUpInside] SomeCustomCell.m - (void)someAction:(id)sender { NSLog(@"cool, the event bubbled up to the cell"); } And to test why this wasn't working, I've added the someAction: method on the ViewController and the ViewController is the one that ends up handling the event that bubbles up

UITableViewCell skipped in responder chain

馋奶兔 提交于 2019-11-29 00:48:57
问题 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 addTarget:nil action:@selector(someAction:) events:UIControlEventTouchUpInside] SomeCustomCell.m - (void)someAction:(id)sender { NSLog(@"cool, the event bubbled up to the cell"); } And to test why this wasn't working, I've added the someAction: method

Is there any way of asking an iOS view which of its children has first responder status? [duplicate]

青春壹個敷衍的年華 提交于 2019-11-26 14:59:34
问题 This question already has answers here : Get the current first responder without using a private API (28 answers) Closed 6 years ago . In Mac OS X, you can find the first responder like this: [[self window] firstResponder] Is there any way of doing it in iOS? Or do you need to enumerate the child controls and send an isFirstResponder message to each one? 回答1: You would need to iterate over all of the child controls and test the isFirstResponder property. When you encounter TRUE , break out of