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
170
Xcode keyboard tips
lachlanroche
1
51
Xcode build script tips
lachlanroche
0
72
Introducing Datomic
lachlanroche
0
59
Introducing Xamarin
lachlanroche
0
61
Other Decks in Programming
See All in Programming
React Nativeならぬ"Vue Native"が実現するかも?_新世代マルチプラットフォーム開発フレームワークのLynxとLynxのVue.js対応を追ってみよう_Vue Lynx
yut0naga1_fa
2
2k
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
3
910
AsyncSequenceとAsyncStreamのプロポーザルを全部読む!!
s_shimotori
1
230
O Que É e Como Funciona o PHP-FPM?
marcelgsantos
0
250
マンガアプリViewerの大画面対応を考える
kk__777
0
450
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
250
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
4
18k
Kotlin 2.2が切り拓く: コンテキストパラメータで書く関数型DSLと新しい依存管理のかたち
knih
0
280
3年ぶりにコードを書いた元CTOが Claude Codeと30分でMVPを作った話
maikokojima
0
750
CSC305 Lecture 14
javiergs
PRO
0
210
CSC305 Lecture 10
javiergs
PRO
0
330
GitHub Copilotを使いこなせ!/mastering_github_copilot!
kotakageyama
2
750
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Bash Introduction
62gerente
615
210k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Why Our Code Smells
bkeepers
PRO
340
57k
Visualization
eitanlees
150
16k
Documentation Writing (for coders)
carmenintech
76
5.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.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