Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introducing the iOS Responder Chain
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
lachlanroche
October 06, 2015
Programming
170
0
Share
Introducing the iOS Responder Chain
Presented at Brisbane Cocoaheads, October 2015
lachlanroche
October 06, 2015
More Decks by lachlanroche
See All by lachlanroche
iPad Multitasking in iOS9
lachlanroche
0
190
Xcode keyboard tips
lachlanroche
1
57
Xcode build script tips
lachlanroche
0
79
Introducing Datomic
lachlanroche
0
83
Introducing Xamarin
lachlanroche
0
73
Other Decks in Programming
See All in Programming
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
570
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
220
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
290
GoogleCloudとterraform完全に理解した
terisuke
1
140
Coding as Prompting Since 2025
ragingwind
0
840
Kingdom of the Machine
yui_knk
2
770
t *testing.T は どこからやってくるの?
otakakot
1
700
PHPer、Cloudflare に引っ越す
suguruooki
1
100
Angular Signal Forms
debug_mode
0
110
How Swift's Type System Guides AI Agents
koher
0
290
Making the RBS Parser Faster
soutaro
0
490
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
240
Featured
See All Featured
Building Adaptive Systems
keathley
44
3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
360
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
340
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
280
Why Our Code Smells
bkeepers
PRO
340
58k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
190
KATA
mclloyd
PRO
35
15k
Transcript
Introducing the Responder Chain Brisbane Cocoaheads Oct 2015 @lachlanroche
None
UIResponder • UIApplication • UIView (UIWindow) • UIViewController • SKNode
• AppDelegate in a new project
UIApplication + sendAction:to:from:forEvent • This is what gets called when
a wired up IBAction is triggered
to target: AnyObject? • “The object to receive the action
message. If to is nil, the app sends the message to the first responder, from whence it progresses up the responder chain until it is handled.” • First Responder in IB means target == nil
“…from whence it progresses up the responder chain until it
is handled.” • Initial receiver is the First Responder. • canPerformAction(_ action: Selector, withSender sender: AnyObject?) -> Bool • nextResponder() -> UIResponder?
None
Dismiss keyboard? • sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil
UITableViewCell • Works with UITableView to implement context menus. •
If you want to send an action via the responder chain, override canPerformAction:withSender:
Finding First Responder static __weak id currentFirstResponder; @implementation UIResponder (FirstResponder)
+ (id) currentFirstResponder { currentFirstResponder = nil; [[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:) to:nil from:nil forEvent:nil]; return currentFirstResponder; } - (void) findFirstResponder:(id)sender { currentFirstResponder = self; } @end