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
56
Introducing Xamarin
lachlanroche
0
61
Other Decks in Programming
See All in Programming
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
430
CSC305 Lecture 06
javiergs
PRO
0
250
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
200
CSC305 Lecture 04
javiergs
PRO
0
270
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
250
CSC509 Lecture 03
javiergs
PRO
0
340
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
230
Swift Concurrency - 状態監視の罠
objectiveaudio
2
540
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
230
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
160
品質ワークショップをやってみた
nealle
0
530
Go言語はstack overflowの夢を見るか?
logica0419
0
380
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The World Runs on Bad Software
bkeepers
PRO
72
11k
Six Lessons from altMBA
skipperchong
29
4k
A better future with KSS
kneath
239
18k
How to Think Like a Performance Engineer
csswizardry
27
2k
How to Ace a Technical Interview
jacobian
280
24k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Typedesign – Prime Four
hannesfritz
42
2.8k
Why Our Code Smells
bkeepers
PRO
340
57k
GitHub's CSS Performance
jonrohan
1032
470k
Become a Pro
speakerdeck
PRO
29
5.6k
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