Hi all,
Can i integrate titanium generated native code(for iphone) with the objective c code??
Thanks
2 Answers
Can you elaborate on what you mean by integrating "with the objective c code"?
It sounds like you are asking if you can use Titanium to generate some obj-C code, then take that and insert it into another obj-C project in XCode.
If so, then you have it backwards.
You can integrate other obj-C code into a Titanium project by putting that native obj-C code into a "module" then referencing that from your Titanium project. See this guide for documentation on creating iOS modules.
As far as I know, you can't go the other way around and insert parts of a Titanium project into another XCode project.
I suppose you could in theory take the XCode project generated by Titanium and directly modify it. But IMHO that would be a VERY poor idea. It would preclude you from easily making changes to the Titanium project source and recreating the XCode project.
Also, you may have a misconception on how Titanium works. It does not take your javascript source and automagically translate it into obj-C code. You may find it instructive to look at these messages on how it works:
This is the code to show date picker dialog.
var tempDate = new Date(); // This picker only supports android platform var picker = Ti.UI.createPicker({ type : Ti.UI.PICKER_TYPE_DATE, minDate : new Date((tempDate.getFullYear() - 10), 0, 1), maxDate : new Date((tempDate.getFullYear() + 10), 11, 31), }); picker.showDatePickerDialog({ value : new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate()), callback : function(e) { if (e.cancel) { // User clicks on cancel button Ti.API.info('User canceled dialog'); alert("User canceled date"); } else { // User selects set or done button. Ti.API.info('User selected date: ' + e.value.getFullYear()); alert("user selected date:"+e.value.getFullYear()); } } });Everything is working well and fine up to android v2.3.6. Up to 2.3.6 date picker dialog is showing both set and cancel buttons. So when ever user clicks on set button then
alert("user selected date:"+e.value.getFullYear());this alert dialog is executing.
If user clicks on cancel button
alert("User canceled date");this alert is executing.
But the problem is from Android v4.0. Date picker dialog is only showing done button. If user clicks on done button then
alert("user selected date:"+e.value.getFullYear());alert is executing perfectly.
If user wants to cancel the dialog then either he needs to press back button or click on out side of date picker view. This means user canceling the dialog even though
alert("user selected date:"+e.value.getFullYear());the same selected alert box is executing. How to solve this problem.
Your Answer
Think you can help? Login to answer this question!