How does UIView nextResponder know what the UIViewController is?

后端 未结 4 1828
暗喜
暗喜 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:21

    If you look at UIView.h, you can see a member variable named _viewDelegate that is of type UIViewController*, this is probably where the view controller reference is stored when the viewcontroller's view property is set, and where it knows to look when you call nextResponder.

提交回复
热议问题