titanium

Opening Camera Instance from a Web App

僤鯓⒐⒋嵵緔 提交于 2019-12-23 05:14:25
问题 Is it possible to open Camera instance from Web App? I have a Web App. displays something, and I want the user to be able to Take a picture and send it to the server. How can I achieve this? 回答1: Using cordova apis it's easy Check out the following code sample: JS: // A button will call this function // To capture photo function capturePhoto() { // Take picture using device camera and retrieve image as base64-encoded string navigator.camera.getPicture(uploadPhoto, onFail, { quality: 50,

Titanium mobile - addEventListener on a view

扶醉桌前 提交于 2019-12-23 03:54:27
问题 i'm making a scrollable menu using common JS. An item of the menu is a view that contains 2 others components : a imageView for the icon, and a label for the text of this menu. The comportement is strange and not the same on the android and ios simulator. On the android, if a click is done on the label or on the imageview, that gives an : "uncaught TypeError: Cannot Read property..." On iphone, that just don't launch anything. If i click somewhere else (still into the view item) but not on

Auto suggest dropdown in titanium example?

浪子不回头ぞ 提交于 2019-12-23 03:22:20
问题 I am able to implement auto suggest drop down in jquery .Now I am implementing a same functionality in titanium but when i googled I don't found much in autosuggestion drop down in titanium . can you suggest a way of autogestion. Mean I have a array (element).When I click on textfield it show related element. 回答1: Try the following code and modify as per your need. Here I Used array(searchArray) as data storage(You can replace it with database field or source whatever as per your requirement)

Titanium Alloy Push Notifications - passing function as callback to be called inside event listener

梦想的初衷 提交于 2019-12-23 01:57:06
问题 I have set up a module for dealing with Push-Notifications which has this: //myPush module var CloudPush = require('ti.cloudpush'); ... var setAppPushNotifications = function(cback) { // Process incoming push notifications log('cback=' + typeof cback); //log is a wrapper to Ti.API.info CloudPush.addEventListener('callback', function (evt,cback) { log('Inside CloudPush-Callback.'); log('cback=' + typeof cback); getIncomingNotification(evt, cback); }); }; var getIncomingNotification = function

how to change hintText color in textField Titanium?

流过昼夜 提交于 2019-12-22 13:56:22
问题 this is my code,and I want to change the hintText Color, how to do? "#email":{ width: '70%', left:'13%', font:{ fontSize:'20sp' }, color: '#fff', hintText:'请输入手机号', borderColor:'transparent', bottom:'2%', //backgroundColor:'#d9d9d9', backgroundColor:'transparent', borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED } 回答1: actually you can't i tried before here what i did to change the hint color and font you need to create a view , textfeild and label with adding change listener on textfeild to show

Issue regarding the change event of textfield in titanium

橙三吉。 提交于 2019-12-22 13:05:31
问题 I have the following code for(var i=0; i<3; i++){ var newTF = Ti.UI.createTextField({ top : 20, hintText : "new text field under "+(i+1)+" text field" width : '100%', id:args.obj.fields[i].id }); $.textFieldView1.add(newTF); } newTF.addEventListener('change',function(e){ if(e.source.getValue=='entered value'){ //do something } else{ //do something } }); Now the problem which I am facing is I am getting the last created textfield(i.e id of last created textfield).So I am not able change

Issue regarding the change event of textfield in titanium

馋奶兔 提交于 2019-12-22 13:02:48
问题 I have the following code for(var i=0; i<3; i++){ var newTF = Ti.UI.createTextField({ top : 20, hintText : "new text field under "+(i+1)+" text field" width : '100%', id:args.obj.fields[i].id }); $.textFieldView1.add(newTF); } newTF.addEventListener('change',function(e){ if(e.source.getValue=='entered value'){ //do something } else{ //do something } }); Now the problem which I am facing is I am getting the last created textfield(i.e id of last created textfield).So I am not able change

Memory Leak in Titanium tabbed iPhone application

对着背影说爱祢 提交于 2019-12-22 12:22:18
问题 this has been giving me a headache for a couple weeks now -- hope somebody can help. I'm building an app for iOs 5.0, using the 2.1.4 SDK in Titanium mobile. My app pulls data from a database, and displays it in a scrollableview using labels and a table. I've noticed that it crashes after a while, and according to instruments, the views within the scrollableView, along with the labels and tableviews, are never released from memory. I use a lot of commonJS, and my code looks someting like this

Convert UTC Date to datetime string Titanium

房东的猫 提交于 2019-12-22 09:57:35
问题 I have a date string "2012-11-14T06:57:36+0000" that I want to convert to the following format "Nov 14 2012 12:27" . I have tried a lot of solutions including Convert UTC Date to datetime string Javascript. But nothing could help me. The following code worked for me in android. But for ios it displays as invalid date var date = "2012-11-14T06:57:36+0000"; //Calling the function date = FormatDate(date); //Function to format the date function FormatDate(date) { var newDate = new Date(date);

How do I draw a line in Titanium?

喜欢而已 提交于 2019-12-22 09:01:00
问题 How Do I draw a line in Titanium that works in both Android and iPhone? 回答1: you could create webview and use the <canvas> tag to draw in the web view 回答2: To create a line, I use; var view = Ti.UI.createView({ height:180, width:300 }); var line = Ti.UI.createView({ height:2, bottom:0, left:0, right:0, borderWidth:1, borderColor:'#aaa' }); view.add(line); 回答3: Add this to your view.xml <View class="line"></View> Add this to your style.tss ".line": { height: '2dp', bottom: '2dp', left: '0dp',