How does UIView nextResponder know what the UIViewController is?

后端 未结 4 1823
暗喜
暗喜 2021-02-07 20:05

Just as a matter of curiosity, how does the nextResponder method implementation of the UIView class know who is the UIViewController that manages the view? The UIResponder docum

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-07 20:21

    there is actually a private api on uiview to get the uiviewcontroller it belongs to. Very handy ;) My guess is when a view is added to a view controller(controller.view) this property is set.

提交回复
热议问题