Responder Chain

suojae·2023년 12월 21일
0

UIKit

목록 보기
5/6

What is responder chain?

The responder chain is an eventing mechanism Mac and iOS programs use for firing events up the UI hiearacht and having others listening for them.

Every control we have in iOS is actually backed by a protocol called UI responder

When a UI control gets an event it fires up the responder chain in the app. Normally the viewController intercept this.

But bysetting to target to be nil and invoking send action on UI applications shared, we can fire the event up the responder chian.

If no one decides to handle it, it eventually makes its way all the way up to the UI application delegate who is the last link in the chain. and if it doesn't handle it, no one does and event goes unhandled.

UI responder chain has same mechanism, only instead of passing itself, we pass a nil. what it revokes the responder chain, and fires the event up.

One thing got to be careful of with navigation controllers is when you present them on top of each other not all the views are always visible in the view hierarchy.

profile
Hi 👋🏻 I'm an iOS Developer who loves to read🤓

0개의 댓글