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
46
Xcode build script tips
lachlanroche
0
67
Introducing Datomic
lachlanroche
0
54
Introducing Xamarin
lachlanroche
0
58
Other Decks in Programming
See All in Programming
Benchmark
sysong
0
230
Team topologies and the microservice architecture: a synergistic relationship
cer
PRO
0
920
SODA - FACT BOOK
sodainc
1
1.1k
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
820
Perplexity Slack Botを作ってAI活用を進めた話 / AI Engineering Summit プレイベント
n3xem
0
670
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
140
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
610
コード書くの好きな人向けAIコーディング活用tips #orestudy
77web
3
320
社内での開発コミュニティ活動とモジュラーモノリス標準化事例のご紹介/xPalette and Introduction of Modular monolith standardization
m4maruyama
1
130
C++20 射影変換
faithandbrave
0
500
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
240
データベースコネクションプール(DBCP)の変遷と理解
fujikawa8
1
270
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
How STYLIGHT went responsive
nonsquared
100
5.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
107
19k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.8k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
RailsConf 2023
tenderlove
30
1.1k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
How to Ace a Technical Interview
jacobian
277
23k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
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