How to access rootViewController from React-Native

本小妞迷上赌 提交于 2021-02-07 01:23:28

问题


I'm creating React-Native module to access Admob. But the GADBannerView object requires rootViewController to perform. Do you know how to create react-native view/module to do it? Thank you very much.


回答1:


From the native objective C code in your module, you can access the root view controller of the app as follows:

UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;


来源:https://stackoverflow.com/questions/29317190/how-to-access-rootviewcontroller-from-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!