Skip to content

This is test Module for iPhone that open new XIB controller from obj - c to titanium

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

jayeshIT/TestModuleiPhone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

you can not directly open XIB from Titanium module but below is Hack

Create Titanium mobile Project 

Add New view controller named  ComPdfreaderViewController

so your 
ComPdfreaderViewController.h
ComPdfreaderViewController.m
ComPdfreaderViewController.xib will there

in yourmodulemodule.h

-(void)OpenNewWin:(id)args;

in yourmodulemodule.m

import below file

#import "TiApp.h"

// This is comtrollerr that you want to open with .XIB
#import "ComPdfreaderViewController.h"

and metohd of .h is like 



-(void)OpenNewWin:(id)args
{
    ComPdfreaderViewController *viewcontroller = [[ComPdfreaderViewController alloc]initWithNibName:@"ComPdfreaderViewController" bundle:nil];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:viewcontroller];
    
    [[TiApp app]showModalController:nav animated:YES];
}

Build module and add to your Proejct and app.js or (index.js if alloy)

var myTestModule = require('com.testmodule');

var btn = Titanium.UI.createButton({
	top : 10,
	left : 10,
	height : 30,
	title : 'Open Win from Module'
});
$.index.add(btn);

btn.addEventListener('click', function(e) {
	myTestModule.openNavWin();
});

$.index.open();


if you run this it will show exception 

NSInternalInconsistencyException

Problem is your XIB is not in the project resources 

if you take new project in x-code and and any view controller wiht .xib and if you run your project than from 
iPhoneSimulator > version > <projectName> > <ApplicationPackage>

right click on it and show Packgae Content you can see the All XIB with .NIB extention are there 

but in the case of your Module project if you run it in x-code than even if you took XIB it will not generate NIB 

How to run Module project in xcode 
-open terminal
-move to your Module proejct directory
-~/Library/Application\ Support/Titanium/mobilesdk/osx/3.2.0.GA/titanium.py run

so the Idea is

Take any Sample project in X-code and import the .h .m and .Xib file in that from your Titanium module Project 
-Run your Sample project in x-code 
-From right click on package and show package content and take your XIB 
- Paste it in to your Assest folder if Alloy and if not /Resource/iphone

Clean project and run ....




About

This is test Module for iPhone that open new XIB controller from obj - c to titanium

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •