¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS

Titanium Mobile

Last-modified: 2018-11-14 (¿å) 15:24:01 (2214d)
Top / Titanium Mobile

´ØÏ¢¥Ú¡¼¥¸


Ìܼ¡

Titanium Mobile¼«¿È¤ÎÃí°ÕÅÀ¼ç¤Ë(Titanium SDK¤Î¥Ð¡¼¥¸¥ç¥ó 2.1.2GA°Ê¹ß¤Ç»î¤·¤¿¾ðÊó¤Ç¤¹)

for (x in ÇÛÎó̾)¤Ç¤Î¥Ï¥Þ¥ê¤ËÃí°Õ

Î㤨¤Ðview¤¬Ê£¿ôÆþ¤Ã¤¿ÇÛÎó¤ËÂФ·¤Æ¸Ä¡¹¤Îview¤ò½èÍý¤¹¤ë¤È¤­¡¢¡Öfor (x in ÇÛÎó̾) ¥ë¡¼¥×¡×¤ò»È¤¦¤È¼¡¤Î·Ù¹ð¤¬½Ð¤ÆÀµ¾ï¤ËÆ°ºî¤·¤Þ¤»¤ó¤Ç¤·¤¿¡£

[WARN] Exception in event callback. {
    line = ???;
    message = "'undefined' is not a function (evaluating 'parts.getWidth()')";
    name = TypeError;
    sourceId = ???;
}

JavaScript¤Ç¤ÏÌäÂê¤Ê¤¤¤Î¤ÇTitanium Mobile¼«¿È¤ÎÉÔ¶ñ¹ç¤Î¤è¤¦¤Ç¤¹¡£¼¡¤Î¤è¤¦¤Ë¤¹¤ì¤Ð²óÈò¤Ç¤­¤Þ¤·¤¿¡£

// Titanium Mobile¤ÇÉÔ¶ñ¹ç¤Îµ¯¤­¤¿¥½¡¼¥¹¡£
// ÇÛÎó¤ËÆþ¤Ã¤Æ¤¤¤ë¸Ä¿ôʬ¥ë¡¼¥×¤¹¤ë¤Î¤Ç¤¹¤¬¡¢¼èÆÀ¤·¤¿view¤òUIView¤Î¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ»È¤¨¤Þ¤»¤ó¡£
for (var view in viewArray) {
	Ti.API.info('width: ' + view.getWidth());
}
// Titanium Mobile¤ÇÀµ¾ï¤ËÆ°¤¯¥½¡¼¥¹¡£
// ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»ÈÍѤ·¤¿for¥ë¡¼¥×¤ËÊѤ¨¤ì¤Ð¼£¤ê¤Þ¤·¤¿¡£
var view;
for (var i = 0; i < viewArray.length; i++) {
	view = viewArray[i];
	Ti.API.info('width: ' + view.getWidth());
}

TIPS

¹ñºÝ²½Âбþ

controllers/foo.js¤ÇÍøÍѤ¹¤ëÊýË¡

$.labelFoo.text = L('bar');

styles/foo.tss¤ÇÍøÍѤ¹¤ëÊýË¡

'#labelFoo': {
	text: L('bar')
}

views/foo.xml¤ÇÍøÍѤ¹¤ëÊýË¡

<Label text="L('bar')" />

¥ê¥ó¥¯

¥¢¥×¥ê̾ÀßÄêÊýË¡

tiapp.xml¤Îname¤Ë±Ñ¸ì¥¢¥×¥ê̾¤òÀßÄꤷ¤Þ¤¹¡£¡Ê¤³¤ÎÃͤÏTi.App.name¤Ç¼èÆÀ¤Ç¤­¤Þ¤¹¡£¤¿¤À¤·¸À¸ì¤Ç̾Á°¤òʬ¤±¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡Ë

 <name>App Foo</name>

¸À¸ìÊ̤˥¢¥×¥ê̾¤òÂؤ¨¤¿¤¤¾ì¹ç¡¢¹¹¤Ë¼¡¤ÎÃͤòÀßÄꤷ¤Þ¤¹¡ÊiOS/Android¶¦ÄÌ¡Ë

i18n/en/app.xml¤Ë±Ñ¸ì¥¢¥×¥ê̾¤òÀßÄꤷ¤Þ¤¹¡£

<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="appname">App Foo</string>
</resources>

i18n/ja/app.xml¤ËÆüËܸ쥢¥×¥ê̾¤òÀßÄꤷ¤Þ¤¹¡£

<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="appname">¥¢¥×¥ê ¥Õ¡¼</string>
</resources>

Ãí°Õ: °ì»þ´üAndroid¤À¤±¼¡¹à¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¤è¤¦¤ËÊÌÅÓÂбþ¤¹¤ëɬÍפ¬Í­¤ê¤Þ¤·¤¿¤¬¡¢iOS¤ÈƱÍͤ˽ñ¤±¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¤½¤¦¤Ç¤¹(»²¹Í:Titanium alloy ¤Ç¹ñºÝ²½¤Î¥¹¥¹¥á ¥¹¥é¥¤¥É¥·¥ç¡¼)¡£

iOS¤ÈAndroid¤Ç¥¢¥×¥ê̾¤òÂؤ¨¤¿¤¤¾ì¹ç¡¢¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£

Ä̾ï¤ÏƱ¤¸¥¢¥×¥ê̾¤¬Ë¾¤Þ¤·¤¤¤Ç¤¹¤¬¡¢¤¹¤Ç¤Ë¥¢¥×¥ê̾¤¬»È¤ï¤ì¤Æ¤¤¤ÆÂؤ¨¤¿¤¤¾ì¹ç¤Ê¤É
i18n/ja/app.xml, i18n/en/app.xml¤ËiOS¥¢¥×¥ê̾¤òÀßÄꤷ¤Þ¤¹¡£

<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="appname">iOS App Foo</string>
</resources>

i18n/ja/strings.xml, i18n/en/strings.xml¤ËAndroid¥¢¥×¥ê̾¤òÀßÄꤷ¤Þ¤¹¡£

<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="appname_android">Android App Foo</string>
</resources>


  1. Resources¤äbuild¥Õ¥©¥ë¥À¤È²£Ê¤ӤËplatform¥Õ¥©¥ë¥À¤òºîÀ®
  2. platform¥Õ¥©¥ë¥À¤ÎÃæ¤Ëandroid¥Õ¥©¥ë¥À¤òºîÀ®
  3. build/android/AndroidManifest.xml¤òplatform/android/AndroidManifest.xml¤Ë¥³¥Ô¡¼ ... SDK 3.2.0°Ê¹ß¤ÏÉÔÍ×
  4. android:label="¥×¥í¥¸¥§¥¯¥È̾"¤È¤Ê¤Ã¤Æ¤¤¤ë£²²Õ½ê¤òandroid:label="@string/appname_android"¤ËÊѹ¹ ... SDK 3.2.0°Ê¹ß¤ÏÉÔÍ×

Ãí°Õ¡§Titanium SDK Ver.3.2.0¤«¤éiOS¤ÈAndroid¤Çname¤ÎÃͤòÊѤ¨¤Ê¤¤¤È¼¡¤Î¥¨¥é¡¼¤¬½Ð¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£¾åµ­¥µ¥ó¥×¥ë¤Ç¤Ï"appname"¤È"appname_android"¤Çʬ¤±¤Æ¤¤¤Þ¤¹¡£

[ERROR] :  .../AndroidManifest.xml:5: error: Error: No resource found that matches the given name (at 'label' with value '@string/appname').
[ERROR] :  .../AndroidManifest.xml:6: error: Error: No resource found that matches the given name (at 'label' with value '@string/appname').

´ØÏ¢¥ê¥ó¥¯¡§ÆüËܸì¤Ë¤·¤¿Android¤Î¥¢¥×¥ê̾¤Ç¥¨¥é¡¼ | nekosuko¥Ö¥í¥°

È÷¹Í¡§AndroidManifest.xml¤ÎÊÔ½¸¤Ë¤Ä¤¤¤ÆÊä­¾ðÊó¤Ç¤¹¡£Titanium¦¤Ç¤¤¤¯¤Ä¤«¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Þ¤¹¤¬¡¢Í¾·×¤Ê¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤Ï³°¤·¤Æ¤ª¤¤¤¿¤Û¤¦¤¬Îɤµ¤½¤¦¤Ç¤¹¡£Î㤨¤ÐÉ®¼Ô¤ÏSD¥«¡¼¥É¤Ë¥¢¥×¥ê°ÜÆ°²Äǽ¤È¤¹¤ë¤¿¤á¤È»×¤Ã¤Æ¡Öandroid.permission.WRITE_EXTERNAL_STORAGE¡×¤òµö²Ä¤·¤Æ¤ª¤¤¤¿¤Þ¤Þ¤Ë¤·¤Æ¤¤¤Þ¤·¤¿¤¬¡¢¥¢¥ó¥É¥í¥¤¥À¡¼¤Ë¥ì¥Ó¥å¡¼°ÍÍꤷ¤¿¤È¤³¤í¡Ø¥¢¥×¥ê¤ÎSD¥«¡¼¥É°ÜÆ°¤Ë¤ÏɬÍפΤʤ¤¸¢¸Â¤Ç¤¹¡£¡Ù¤È¤´»ØŦ¤¤¤¿¤À¤­¤Þ¤·¤¿¡£
´ØÏ¢¥ê¥ó¥¯¡§Android¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤ò¸º¤é¤¹ | ¥¢¥×¥êºî²È¸«½¬¤¤¥á¥â

Ãí°Õ¡§¥«¥á¥é¤ò»ÈÍѤ¹¤ë¾ì¹ç¤ÏSD¥«¡¼¥É¤Ø¤Î½ñ¤­¹þ¤ß¸¢¸Â¤¬É¬ÍפÊAndroidüËö¤â¤¢¤ë¤½¤¦¤Ç¡¢¡Öandroid.permission.WRITE_EXTERNAL_STORAGE¡×¤òµö²Ä¤·¤Æ¤ª¤¤¤¿¤Û¤¦¤¬¤¤¤¤¤½¤¦¤Ç¤¹¡£
´ØÏ¢¥ê¥ó¥¯¡§Android¤ÇSD¥«¡¼¥É´ØÏ¢¤Î¥¨¥é¡¼ | Android¥¢¥×¥ê³«È¯»¨µ­

̤³Îǧ¾ðÊó¡§http://¡Á¤Ç²èÁü¤òɽ¼¨¤¹¤ë¾ì¹ç¤Ï¡¢¡Öandroid.permission.WRITE_EXTERNAL_STORAGE¡×¤òµö²Ä¤·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤½¤¦¤Ç¤¹¡£¥­¥ã¥Ã¥·¥å¤Î´Ø·¸¤À¤½¤¦¤Ç¤¹¡£
»²¹Í¥Ú¡¼¥¸¡§¥¤¥¬¥¤¥È¥«¥ó¥¿¥ó -PhoneGap¤«¤éTitaniumMobile¤Ë¾è¤ê´¹¤¨¤Æ10Æü¤¯¤é¤¤¤Ç¥¢¥×¥ê¤òºî¤Ã¤¿Ïà | DASALOG

̤³Îǧ¾ðÊó¡§AdMob¤ò»ÈÍѤ¹¤ë¾ì¹ç¤â¡Öandroid.permission.WRITE_EXTERNAL_STORAGE¡×¤òµö²Ä¤·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¤Ç¤¹¡£
»²¹Í¥Ú¡¼¥¸¡§ Titanium mobile ¤Çºî¤Ã¤¿Android¥¢¥×¥ê¤Ëadmob¤òÆþ¤ì¤ë

¥·¥ß¥å¥ì¡¼¥¿¤«¤É¤¦¤«È½ÃÇ

 if (Titanium.Platform.model === 'google_sdk' || Titanium.Platform.model === 'Simulator') {
}

iOS¤Î¥Ð¡¼¥¸¥ç¥ó¤Çʬ´ô¤µ¤»¤ëÊýË¡

// ¡Ö4.3.2¡×¤Ê¤É¤È¤¤¤Ã¤¿¥Ð¡¼¥¸¥ç¥óʸ»úÎó¤ò¥Ñ¡¼¥¹
var versionNumber = parseFloat(Ti.Platform.version);
if (versionNumber >= 5) {
	// ¥Ð¡¼¥¸¥ç¥ó£µ°Ê¾å
} else if (versionNumber < 5) {
	// ¥Ð¡¼¥¸¥ç¥ó£µÌ¤Ëþ
} else {
	// ¥¨¥é¡¼½èÍý
}

WebView¤ÇÇطʤòÆ©ÌÀ¤Ë¤¹¤ëÊýË¡

¥Í¥¤¥Æ¥£¥Ö¤ËÈæ¤Ù¤ÆÃÙ¤¤¤è¤¦¤Ç¤¹¡£

// Resources/file/foo.html¤ÎWebView¤òºîÀ®
var fooWebView = Ti.UI.createWebView({
	url: '/fle/foo.html',
	backgroundColor: 0
});

¥×¥í¥°¥é¥à¤òÊ£¿ô¤Î¥Õ¥¡¥¤¥ë¤Ëʬ³ä¤¹¤ëÊýË¡

Resources/window1.js

var win = Ti.UI.createWindow({title:'window1'});
var label = Ti.UI.ceateLabel({text:'Say there'});
win.add(label);
exports.window = win;

Resources/app.js

var win1 = require('window1').window;
var tab = Ti.UI.createTab(window:win1);
var tabGroup = Ti.UI.createTabGroup();
tabGroup.addTab(tab);
tabGroup.open();

exports¤ò»È¤Ã¤¿CommonJS¥¹¥¿¥¤¥ë¤Çµ­½Ò¤·¡¢require()¤ÇÆɤ߹þ¤ß¤Þ¤¹¡£exports¤Ç»ØÄꤵ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤À¤±¤¬¸ø³«¤µ¤ì¡¢¤·¤«¤â¤½¤ì¤¬¥µ¥ó¥×¥ë¤ÎÎã¤Çwin1¤ËÊĤ¸¹þ¤á¤é¤ì¤ë¤Î¤¬¥Ý¥¤¥ó¥È¡ª
»²¹Íurl: @IT QA

[1, 2, 3], [101, 2, 1, 10], [2, 1]¤È¤¤¤Ã¤¿3¤Ã¤Ä¤ÎÇÛÎó¤Ç¶¦Ä̤¹¤ëÍ×ÁǤÎÇÛÎó¤ò¼èÆÀ¤¹¤ëÊýË¡

Ãí¡§underscore.js¤ÏAlloy¤ò»ÈÍѤ¹¤ë¤È¥Ç¥Õ¥©¥ë¥È¤ÇÍøÍѤǤ­¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£
Titanium Mobile¤Ë¸Â¤Ã¤¿ÏäǤϤ¢¤ê¤Þ¤»¤ó¤¬¡¢underscore.js¤È¤¤¤¦¥é¥¤¥Ö¥é¥ê¤ò»ÈÍѤ¹¤ì¤Ð¡¢´Êñ¤Ëµ­½Ò¤Ç¤­¤Þ¤¹¡£underscore.js¥Õ¥¡¥¤¥ë¤òResouces/vendor/°Ê²¼¤ËÇÛÃÖ¤·¤Æ¡¢

_ = require('vendor/underscore')._
var arrayX = _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);

¶¦Ä̹à¤Î[1, 2]¤ò¼èÆÀ¤Ç¤­¤Þ¤¹¡£ ¾¤Ë¤âÇÛÎóÁàºî¤Ê¤É¤ÎÊØÍø¤Ê½èÍý¤¬Âô»³¤¢¤ê¤Þ¤¹¡£¥é¥¤¥Ö¥é¥ê¤äAPI¤Ïhttp://underscorejs.org/

»²¹Íurl:

¥á¡¼¥ë¥À¥¤¥¢¥í¥°É½¼¨

#pre{{
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.setSubject('Hello from Titanium!');
emailDialog.setToRecipients(['foo@yahoo.com']);
emailDialog.setCcRecipients(['bar@yahoo.com']);
emailDialog.setBccRecipients(['blah@yahoo.com']);

if (Ti.Platform.name == 'iPhone OS') {
emailDialog.setMessageBody('<b>Appcelerator Titanium Rocks!</b>');
emailDialog.setHtml(true);
emailDialog.setBarColor('#336699');
} else {
emailDialog.setMessageBody('Appcelerator Titanium Rocks!');
}

// attach a blob
emailDialog.addAttachment(event.media);

// attach a file
var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'cricket.wav');
emailDialog.addAttachment(f);

emailDialog.addEventListener('complete',function(e) {
if (e.result == emailDialog.SENT) {
if (Ti.Platform.osname != 'android') {
// android doesn't give us useful result codes.
// it anyway shows a toast.
alert('message was sent');
}
} else {
alert('message was not sent. result = ' + e.result);
}
});
emailDialog.open();
}}

°úÍѸµurl: http://stackoverflow.com/questions/4407888/sending-email-using-titanium-developer-application

Titanium¤Î¥×¥í¥¸¥§¥¯¥È¤òºï½ü¤¹¤ëÊýË¡

  1. Titanium Studio¤Çº¸¾å¤ÎProject Explorer¤ò³«¤¯
  2. ¾Ã¤·¤¿¤¤¥×¥í¥¸¥§¥¯¥È¤òÁªÂò
  3. [Project] - [Close Project]
  4. [Edit] - [Delete]
  5. Finder¤Ç¥×¥í¥¸¥§¥¯¥È¤Î¥Õ¥©¥ë¥À¤òºï½ü

¥¿¥Ö¥Ð¡¼¤ÎÇØ·Ê¿§Êѹ¹

Titanium SDK 3.0¤«¤é²Äǽ¤Ë¤Ê¤Ã¤¿¤½¤¦¤Ç¤¹¡£

var self = Ti.UI.createTabGroup({
	tabsBackgroundColor : 'red'
});

¤Þ¤¿¡¢²èÁüÀßÄê¤Ê¤É¾ÜºÙ¤ËÀßÄê¤Ç¤­¤ë¤è¤¦¤Ç¤¹¡£

¥ª¥Ö¥¸¥§¥¯¥È¤ÎÃæ¿È¤òɽ¼¨¤¹¤ëÊýË¡¡ÊPHP¤Ç¤¤¤¦¤È¤³¤í¤Îvar_dump¡Ë

Ti.API.info(JSON.stringify(obj));

µ»½Ñ¼Ô¥Ö¥í¥°

TIPS¥ê¥ó¥¯

Appcelerator¥ê¥ó¥¯

¥æ¡¼¥¶¡¼²ñ¥ê¥ó¥¯

¥ê¥ó¥¯