Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Best way to incorporate native UIKit-Subclasses classes into a custom TiModule

Hi there,

currently, i want to port some iOS native code into a custom TiModule. My original code contains a UIViewController and a UIView (no Titanium SDK integration yet, just plain iOS-SDK). The code works well, when being compiled and run in Xcode.
Now i need to know what is the best practice to incorporate the existing code into a custom TiModule. I prefer not to rewrite my UIViewController and UIView to subclasses of TiUIViewController/TiUIProxy/TiUIView. I think it would be less work to implement some sort of adapter using the Ti-Classes.

I already tried to instantiate the UIViewController from a TiUIView (with its own TiUIProxy) in my TiModule and then add the UIViewController's view to the TiUIView. The bad thing about it is, that UIButtons and UITextFields/UITextAreas inside my UIView get overlayed with some other views that are layed out by the Ti-SDK, so touch-interaction with the UIView and its subviews just isn't possible.

Can anyone recommend a way to achieve the goal without having to rewrite my UIKit-Classes into Ti-Classes? Any help would be greatly appreciated. Thanks in advance.

— asked November 10th 2010 by Mr. Q
  • iphone
  • mobile
  • module
  • timodule
  • uikit
  • uiview
  • uiviewcontroller

2 Answers

  • This is exactly what I need to know too!

    — answered November 10th 2010 by Patrick van Zadel
  • Any Luck on this I also need the same thing to work.

    — answered January 21st 2011 by Investis App Development
    1 Comment
    • Unfortunately, there seems to be no other information than the module developers guide which only scratches the surface of module development. In the meantime, i got it to work. But it was a real pain to get there as a lot of problems occurred during the implementation.
      What i did was to rewrite my native iOS code into TiUIView and TiUIViewProxy classes. But i had to deal with lots of problems like threading issues, lack of documentation on the Obj-C side of the Ti framework, et cetera. I am seriously thinking about abandoning the whole Ti stuff because for what i need, the JavaScript part of it lacks too many features and extending functionality by implementing your own modules is way too complex and time consuming.

      — commented January 25th 2011 by Mr. Q
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.