在响应链中使用视图控制器Using View Controllers in the Responder Chain[苹果官方文档的翻译]

来源:互联网 发布:中国人口数据分析 编辑:程序博客网 时间:2024/06/11 11:32

View controllers are descendants of the UIResponder class and are therefore capable of handling all sorts of events. When a view does not respond to a given event, it passes that event to its superview, traveling up the view hierarchy all the way to the root view. However, if any view in the chain is managed by a view controller, it passes the event to the view controller object before passing it up to the superview. In this way, the view controller can respond to events that are not handled by its views. If the view controller does not handle the event, that event moves on to the view’s superview as usual.

这里有重要的一句话,如果响应链中的视图是由视图控制器管理的,它先把触摸事件传递给视图控制器对象,然后才把事件传递给它的父视图。

0 0
原创粉丝点击