Given a view, how do I get its viewController?

后端 未结 13 719
北海茫月
北海茫月 2020-11-28 02:00

I have a pointer to a UIView. How do I access its UIViewController? [self superview] is another UIView, but not the

13条回答
  •  粉色の甜心
    2020-11-28 02:43

    UIView has a variable called window ?

    So this will return a view controller

    you can access it like this self.window?.rootViewController

提交回复
热议问题