ȥå   Խ ʬ Хåå ź ʣ ̾ѹ   ñ측 ǽ   إ   ǽRSS

Titanium Mobile

Last-modified: 2016-03-02 () 17:35:47 (631d)
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Զε
// äƤĿʬ롼פΤǤviewUIViewΥ֥ȤȤƻȤޤ
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.xmlname˱Ѹ쥢ץ̾ꤷޤʤͤ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 ǹݲΥ 饤ɥ硼)

iOSAndroidǥץ̾ؤ硢Τ褦ˤޤ

̾Ʊץ̾˾ޤǤǤ˥ץ̾ȤƤؤʤ
i18n/ja/app.xml, i18n/en/app.xmliOSץ̾ꤷޤ

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

i18n/ja/strings.xml, i18n/en/strings.xmlAndroidץ̾ꤷޤ

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


  1. ResourcesbuildեȲ¤Ӥplatformե
  2. platformեandroidե
  3. build/android/AndroidManifest.xmlplatform/android/AndroidManifest.xml˥ԡ ... SDK 3.2.0ʹߤ
  4. android:label="ץ̾"ȤʤäƤ룲սandroid:label="@string/appname_android"ѹ ... SDK 3.2.0ʹߤ

աTitanium SDK Ver.3.2.0iOSAndroidnameͤѤʤȼΥ顼Ф褦ˤʤޤ嵭ץǤ"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פĤƤۤǤ
Ϣ󥯡AndroidSDɴϢΥ顼 | Androidץ곫ȯ

̤ǧhttp://Dzɽϡandroid.permission.WRITE_EXTERNAL_STORAGEפĤʤȤʤǤåδطǤ
ͥڡȥ󥿥 -PhoneGapTitaniumMobile˾괹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.htmlWebView
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.jsAlloyѤȥǥեȤѤǤ褦ˤʤޤ
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]Ǥޤ ¾ˤʤɤʽޤ饤֥APIhttp://underscorejs.org/

url:

᡼ɽ

	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