By default, UIView returns its UIViewController in nextResponder
function - if it has one. I think UIView must have hold an reference to the UIViewController.
If so, won't it lead to a circular reference between them, since UIViewController also holds an reference to UIView?
--- update -----------
I notice that the UIView has an private member named _viewDelegate
, which is the UIViewController. Anyone knows how this is assigned?
--- update -----------
I found that when the view is loaded and assigned to the view controller, its _viewDelegate
property points to the view controller at the same time. So this probably happens in the didSet
event of view
property.
According to the name of property _viewDelegate
, it should be a delegate, which normally is a weak
reference, I guess.
UIViewControllerDelegate
. Where do you see any documentation that aUIView
holds a weak (or other type) of reference to aUIViewControllerDelegate
.UIViews
do not have to have aUIViewController
. My concern (I am not the OP BTW) is correctness. – zaph