How to inspect the responder chain?

前端 未结 6 1254
甜味超标
甜味超标 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:27

    You can iterate over the responder chain using the nextResponder method of NSResponder. For your example, you should be able to start with the current view, and then repeatedly print out the result of calling it in a loop like this:

    NSResponder *responder = currentView;
    while ((responder = [responder nextResponder])) {
         NSLog(@"%@", responder);
    }
    

提交回复
热议问题