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
150
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
150
Xcode keyboard tips
lachlanroche
1
44
Xcode build script tips
lachlanroche
0
63
Introducing Datomic
lachlanroche
0
51
Introducing Xamarin
lachlanroche
0
55
Other Decks in Programming
See All in Programming
テストコード書いてみませんか?
onopon
2
200
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
8
1.9k
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
7
1.5k
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
800
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
290
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
160
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
120
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
260
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
570
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
450
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
The Language of Interfaces
destraynor
154
24k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Visualization
eitanlees
146
15k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
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