Create your own presentation using the iOS module and use them in titanium

I want to create an iOS module in which I have a viewController class with its .xib file. now the problem is how to call this view from my titanium code. I know that there is proxy server access, but I don’t know how to use them due to not very good documentation.

So far I have created a module in which it is possible to transfer not graphic data, but how to access the View controller from my module.

I already checked the wiki application, but that didn't help. Any tutorial that helps me will be helpful

+6
source share
1 answer

See the TiModdevguideDemoView.h / m and TiModdevguideDemoViewProxy.h / m files in the iOS mod guide:

https://github.com/appcelerator/titanium_modules/tree/master/moddevguide/mobile/ios/Classes

It demonstrates just the connection between views and proxy views. In this case, he makes a square.

You can see that it is used in JavaScript here: https://github.com/appcelerator/titanium_modules/blob/master/moddevguide/mobile/ios/example/demos/viewproxyDemo.js

As soon as you have it in your hand and you can do a simple viewing, you are ready to take the next step to resolve your issue. You need to convert your XIB to NIB. The easiest way is to add the XIB to your own project, compile the project, and then pull out the NIB. Dump it in the assets for the module, and then link to it from the module code. Unfortunately, I do not have a public source that uses the NIB for communication, but I can show you a fragment. (A number of modules that we support use this method, so I know that you can successfully run it! Jira, Gigya, city airship and others.)

NSBundle* bndl = [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ti.jira/1.0/assets/JMC.bundle"]]; JMCSketchViewController *sketchViewController = [[[JMCSketchViewController alloc] initWithNibName:@"JMCSketchViewController" bundle:bndl] autorelease]; 

Please note that we usually do not use NIB unless we have something from a third party that forces us. It is easier to simply create views imperatively, rather than declaratively.

You can learn more about proxy views and views in our guide for iOS modem developers. Once you understand what I linked above in the modem guide (and successfully create your own), the mod guide will be much more useful to you. (I have some updates to the manual in the pipeline that will facilitate understanding, by the way). http://docs.appcelerator.com/titanium/2.0/index.html#!/guide/iOS_Module_Development_Guide

Hope this helps. Let me know if I can do anything else. There is a small hump of understanding for you to complete, but as soon as you put a little fat on your elbow, you will work at full speed with the development of the module.

+4
source

Source: https://habr.com/ru/post/915072/


All Articles