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
180
Xcode keyboard tips
lachlanroche
1
53
Xcode build script tips
lachlanroche
0
74
Introducing Datomic
lachlanroche
0
69
Introducing Xamarin
lachlanroche
0
66
Other Decks in Programming
See All in Programming
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
Oxlint JS plugins
kazupon
1
1.1k
個人開発は儲からない - それでも開発開始1ヶ月で300万円売り上げた方法
taishiyade
0
110
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
430
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
12
6.7k
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
160
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
170
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
250
CSC307 Lecture 09
javiergs
PRO
1
850
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
200
生成AIを活用したソフトウェア開発ライフサイクル変革の現在値
hiroyukimori
PRO
0
140
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
140
Amusing Abliteration
ianozsvald
0
120
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
130
Technical Leadership for Architectural Decision Making
baasie
2
270
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
110
Color Theory Basics | Prateek | Gurzu
gurzu
0
210
GitHub's CSS Performance
jonrohan
1032
470k
Thoughts on Productivity
jonyablonski
75
5.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
810
Being A Developer After 40
akosma
91
590k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Leo the Paperboy
mayatellez
4
1.5k
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