How to inspect the responder chain?

前端 未结 6 1258
甜味超标
甜味超标 2020-12-08 10:51

I\'m doing some crazy multiple documents inside a single window stuff with the document-based architecture and I\'m 95% done.

I have this two-tier document architect

6条回答
  •  粉色の甜心
    2020-12-08 11:19

    Here is another version for Swift users:

    func printResponderChain(_ responder: UIResponder?) {
        guard let responder = responder else { return; }
    
        print(responder)
        printResponderChain(responder.next)
    }
    

    Simply call it with self to print out the responder chain starting from self.

    printResponderChain(self)
    

提交回复
热议问题