使用UIViewController插件 [英] Plugin with UIViewController

查看:144
本文介绍了使用UIViewController插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以向我解释Cordova iOS插件的生命周期吗?

Can somebody explain to me the life-cycle of a Cordova iOS plugin?

特别是,我有一个我想要开发的插件,其中包含 UIView (以及相关的 UIViewController )。

Particularly, I have a plugin I am trying to develop which contains a UIView (and associated UIViewController).

我如何获得Cordova UIView 来自我的扩展 CDVPlugin 类,所以我可以将我的插件添加为子视图(这是它是如何工作的?)。

How do I obtain the Cordova UIView from my extended CDVPlugin class, so I can add my plugin as a sub-view to it (is this how it works?).

我想暂时在我的Cordova应用程序上显示我的 UIView ,然后解雇它,返回我的JS / HTML应用程序。

I would like to temporarily show my UIView on top of my Cordova app, then dismiss it, returning to my JS/HTML app.

推荐答案

如果你想在整个UIViewController上呈现整个UIViewController(全屏) cordova webview,你可以做到

If you want to present the whole UIViewController (full screen) over the cordova webview, you can do

[self.viewController presentViewController:yourViewController animated:YES completion:nil];

示例:

相机插件

InAppBrowser插件

如果你只想在cordova webview上添加一个视图,你可以这样做

If you want to add just a view over the cordova webview, you can do

[self.viewController.view addSubview:yourView];

示例:

MapKit插件

差异是,第一种方法呈现整个视图控制器,全屏,第二种方法显示一个视图,可以有你想要的大小和位置,如果你没有使它具有相同的设备屏幕大小,用户将看到你的Cordova webview在它下面

The diference is, that the first method present the whole view controller, full screen, the second method shows a view that can have the size and position you want, if you don't make it have the same size of the device screen the user will see your cordova webview under it

这篇关于使用UIViewController插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆