Closed tzmartin closed 11 years ago
have a look here: https://github.com/viezel/NappUI/issues/2
the quick answer: remember to do this: https://github.com/viezel/NappUI#how-to-use
Ah yes. That works. Btw, I had a the same issue with a module I wrote for a vertical ScrollableView class which overrides several methods, etc. Your symbol pre-loader technique fixed it as well.
So this is one for the books.. this symbol pre-loader technique is needed if you write any module that needs to override delegate instance methods.
For example:
– webView:shouldStartLoadWithRequest:navigationType:
– webViewDidStartLoad:
– webViewDidFinishLoad:
– webView:didFailLoadWithError:
Thanks for sharing your brain.
Quick note about the preload technique. There's a slightly easier way to define the symbols without requiring users to require()
dependencies.
dk.napp.ui.js
file to your module assets directory that contains the following:Ti.UI.createWindow();
Ti.UI.createTab();
Ti.UI.createTabGroup();
Ti.UI.createWindow();
Ti.UI.iPhone.createNavigationGroup();
Ti.UI.createTextField();
Ti.UI.createWebView();
Ti.UI.createSearchBar();
Ti.UI.createScrollableView();
Ti.UI.createPicker();
Ti.UI.iOS.createToolbar();
This will instantiate the symbols without requiring users to embed commonJS or JS object references.
preloader.js
file into the app/assets/ or Resources/ folder that contains the above mentioned code. No other action is needed.The key here is Titanium statically analyzes the JS files to determine which symbols are needed before the JS interpreter is invoked. So all you need to do is reference the appropriate Ti.UI class, which marks it for inclusion during the compile process.
I tested for device builds using both techniques.
Thoughts?
Hi Terry. Thanks for picking my brain :) Yep, you got it. The static analysis is why the UI proxy calls are needed. Great idea about using the assets folder. Why didn't I think of that :) much more slick way, so the developer does not need to know HOW the Ti SDK works.
Please do a PR if you don't mind.
Again, great people are using this, and you have have any additional extended API, please submit them.
Works great for simulator tests, but I'm having an issue with device testing. Seems the class files are undefined, which throws an error during app build. Can you test on your end?
Env: