如何从扩展的 iOS 模块显示 viewController
我正在使用 Titanium 创建一个模块,该模块在 iOS 中进行了扩展。在该模块中,我正在创建一个 viewController,我想在调用该模块时将其显示在屏幕上。 无法弄清楚..什么是正确的方法。
I am creating an Module in Titanium which is extended in iOS. In that module I am creating a viewController and I want to show it on the screen when i called that module.
Not able to figure it out.. What will be right approach for it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在主 TiModule 中,您必须使用
[TiApp app]
作为 UIViewController。但仅仅使用这个就会给你带来线程问题的错误,所以,我们需要创建另一个方法来使用[TiApp app]
。 EG在模块的启动方法中写入:
这可确保作为参数传递的方法在主线程上运行,因为它具有一些与 UI 相关的操作。如果没有此语句,您将在后台线程中收到 UI 渲染错误。
然后实现以下方法,
因此,这将打开您创建的控制器。
In the main TiModule, you have to use
[TiApp app]
for UIViewController. But just using this will give you error of Threading problem, so, we need to create another method to use[TiApp app]
. E.G.In startup method of the module write:
This ensures that the method which is passed as an argument runs on Main Thread because it has some UI related operation. Without this statement, you will receive error of UI rendering in background thread.
Then implement following method,
So, this will open up the controller, which you created.