How does UIView nextResponder know what the UIViewController is?

后端 未结 4 727
旧时难觅i
旧时难觅i 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条回答
  •  心在旅途
    2021-02-07 20:26

    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.

提交回复
热议问题