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
lachlanroche
October 06, 2015
Programming
0
160
Introducing the iOS Responder Chain
Presented at Brisbane Cocoaheads, October 2015
lachlanroche
October 06, 2015
Tweet
Share
More Decks by lachlanroche
See All by lachlanroche
iPad Multitasking in iOS9
lachlanroche
0
160
Xcode keyboard tips
lachlanroche
1
50
Xcode build script tips
lachlanroche
0
71
Introducing Datomic
lachlanroche
0
55
Introducing Xamarin
lachlanroche
0
60
Other Decks in Programming
See All in Programming
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
240
Infer入門
riru
4
1.1k
CEDEC2025 長期運営ゲームをあと10年続けるための0から始める自動テスト ~4000項目を50%自動化し、月1→毎日実行にした3年間~
akatsukigames_tech
0
110
それ CLI フレームワークがなくてもできるよ / Building CLI Tools Without Frameworks
orgachem
PRO
17
3.7k
Vibe coding コードレビュー
kinopeee
0
420
構文解析器入門
ydah
7
2k
ZeroETLで始めるDynamoDBとS3の連携
afooooil
0
150
Quality Gates in the Age of Agentic Coding
helmedeiros
PRO
1
120
PHPカンファレンス関西2025 基調講演
sugimotokei
6
1.1k
kiroでゲームを作ってみた
iriikeita
0
150
なぜあなたのオブザーバビリティ導入は頓挫するのか
ryota_hnk
5
580
ワープロって実は計算機で
pepepper
2
1.1k
Featured
See All Featured
Making Projects Easy
brettharned
117
6.3k
How to train your dragon (web standard)
notwaldorf
96
6.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
19k
Navigating Team Friction
lara
188
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
Rails Girls Zürich Keynote
gr2m
95
14k
Scaling GitHub
holman
461
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
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