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
140
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
140
Xcode keyboard tips
lachlanroche
1
42
Xcode build script tips
lachlanroche
0
62
Introducing Datomic
lachlanroche
0
49
Introducing Xamarin
lachlanroche
0
55
Other Decks in Programming
See All in Programming
C#/.NETのこれまでのふりかえり
tomokusaba
1
160
役立つログに取り組もう
irof
26
8.6k
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
9
1k
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
510
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
390
Outline View in SwiftUI
1024jp
1
110
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
430
Universal Linksの実装方法と陥りがちな罠
kaitokudou
1
220
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
328
21k
A Philosophy of Restraint
colly
203
16k
We Have a Design System, Now What?
morganepeng
50
7.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Automating Front-end Workflow
addyosmani
1365
200k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Git: the NoSQL Database
bkeepers
PRO
425
64k
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