Titanium Community Questions & Answer Archive

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

Using nib Files in iOS Modules

I have a subclass of the UIViewController class that needs to be initialized with a nib file. Where do I put the .xib file in the xcode project? Currently, I am using the 'assets' folder that was generated but I keep getting this Exception:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/carlo/Library/Application Support/iPhone Simulator/4.3/Applications/F9738EC6-793A-4334-B143-67ADACFB41DA/iosmymodule.app> (loaded)' with name 'MyView''

Also, if my ViewController's xib file needs to use images from the resource folder, where must their files be located in the xcode project? Should they also be located in the assets folder?

xCode version is 3.2.6 and titanium mobile sdk version 1.7.2.

— asked August 31st 2011 by carlo benitez
  • ios
  • module
0 Comments

3 Answers

  • Accepted Answer

    What I noticed in the application resource package is that 'MyView' was not converted into a nib file. It remained to be xib even when the module was built. What I did, is to make the nib file first and put it in the Titanium project '/Resources/iphone/' folder - this way, it goes to the root folder in the application package and this fixed my problem. :-)

    — answered September 1st 2011 by carlo benitez
    permalink
    2 Comments
    • Thanks!!!!! It's work!! I tried to fix this problem for 2day. :(

      — commented September 29th 2011 by JongEun Lee
    • Hi Carlo, Lee,

      Can you tell me how did you convert the xib file to nib? Thanks in advance !

      — commented June 13th 2013 by biswarup dasgupta
  • Try this… Go to the properties of the .xib files in the file inspector, set the property 'Location' to 'Relative to project'.

    Let me know if that works.

    — answered August 31st 2011 by Matt Apperson
    permalink
    1 Comment
    • Yes, I have tried that but it does not work for me. I have tried putting the xib file on the Resources/iphone/ folder of the Titanium mobile project as well. When I view the package contents of the application on the simulator, I can see that the file are there but the exception is still there.

      — commented August 31st 2011 by carlo benitez
  • Hi,

    Can you please explain how you created the nib file and how you connected it to your class in a titanium module?

    Thank

    — answered August 5th 2013 by Ophir 'Shlomi' Oren
    permalink
    0 Comments
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.