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
150
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
44
Xcode build script tips
lachlanroche
0
64
Introducing Datomic
lachlanroche
0
51
Introducing Xamarin
lachlanroche
0
56
Other Decks in Programming
See All in Programming
Lottieアニメーションをカスタマイズしてみた
tahia910
0
120
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
490
法律の脱レガシーに学ぶフロントエンド刷新
oguemon
5
730
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
260
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
110
Kanzawa.rbのLT大会を支える技術の裏側を変更する Ruby on Rails + Litestream 編
muryoimpl
0
220
ARA Ansible for the teams
kksat
0
150
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.1k
Software Architecture
hschwentner
6
2.1k
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
360
Compose でデザインと実装の差異を減らすための取り組み
oidy
1
300
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
120
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Statistics for Hackers
jakevdp
797
220k
Facilitating Awesome Meetings
lara
51
6.2k
Thoughts on Productivity
jonyablonski
69
4.5k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Docker and Python
trallard
44
3.3k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Building Adaptive Systems
keathley
40
2.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
51k
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