简体   繁体   English

如何从扩展的iOS模块显示viewController

[英]How to display a viewController from an extended iOS module

I am creating an Module in Titanium which is extended in iOS. 我正在用Titanium创建一个在iOS中扩展的模块。 In that module I am creating a viewController and I want to show it on the screen when i called that module. 在该模块中,我正在创建一个viewController,我想在调用该模块时在屏幕上显示它。 Not able to figure it out.. What will be right approach for it. 无法弄清楚。什么是正确的方法。

In the main TiModule, you have to use [TiApp app] for UIViewController. 在主TiModule中,必须对UIViewController使用[TiApp app] But just using this will give you error of Threading problem, so, we need to create another method to use [TiApp app] . 但是仅使用此方法将给您带来线程问题的错误,因此,我们需要创建另一种方法来使用[TiApp app] EG 例如

In startup method of the module write: 在模块的启动方法中编写:

ENSURE_UI_THREAD(OnMainUI, nil); ENSURE_UI_THREAD(OnMainUI,nil);

This ensures that the method which is passed as an argument runs on Main Thread because it has some UI related operation. 这样可以确保作为参数传递的方法在主线程上运行,因为它具有一些与UI相关的操作。 Without this statement, you will receive error of UI rendering in background thread. 如果不使用此语句,您将在后台线程中收到UI渲染错误。

Then implement following method, 然后执行以下方法,

- (id) OnMainUI {
   UIViewController *controller = [INITIALIZATION OF CONTROLLER];
   [[TiApp app] showModalController: controller animated: YES];
}

So, this will open up the controller, which you created. 因此,这将打开您创建的控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试显示从一个viewController捕获的UIImage,并在iOS中的另一个视图中显示它 - Trying to display a UIImage captured from one viewController, and display it in another in iOS 如何调用viewController的方法以在子视图中显示新内容? (IOS) - How to call a method of the viewController to display something new from within a subview? (iOS) 如何显示与附加到UITabBarControLler的ViewController不同的ViewController - How could I display different ViewController from ViewController attached to UITabBarControLler 如何在标签栏iOS中将数据从ViewController传递到ViewController? - How to pass data from ViewController to a ViewController in a tab bar iOS? 尝试从iOS中的显示中删除ViewController时获取黑屏 - Getting black screen when trying to remove ViewController from display in iOS 当我从iOS中的单独ViewController调用视图时,无法显示视图 - Unable to display view when I call it from a separate ViewController in iOS 如何在iOS中从rootViewController推送Viewcontroller - How to push Viewcontroller from rootViewController in iOS 如何从iOS中的NSObject类导航到ViewController? - How to navigate to a ViewController from NSObject Class in iOS? iOS如何从appdelegate发送refreshToken到viewcontroller - ios how to send refreshToken from appdelegate to viewcontroller iOS如何从框架启动ViewController - iOS how to start a viewcontroller from framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM