1

Appcelerator Titanium を使用してマルチスクリーン アプリを作成する方法を理解しようとしています。私は Android 開発に精通しているので、Android SDK を使用していくつかの異なるアクティビティを作成し、それぞれが異なる作業 (ログイン画面、アイテムのリストを表示する画面など) を行います。Titanium で同等のものは何ですか? app.js がアプリの主要部分であることはわかっていますが、すべてのコードをその 1 つのファイルに入れることはお勧めできません。キッチン シンク アプリには多くのファイルと機能がありますが、それらがどのように組み合わされるのかわかりません。では、いくつかの画面で異なることを行う基本的なアプリのプロジェクトを Titanium で作成するための推奨される方法は何ですか? 画面のチタンの概念がありません。

4

5 に答える 5

2

番号..

あなたはそれを好きにすることができます

var button = Ti.UI.createButton({..});

button.addEventListener('click',function(e){
    var window = Ti.UI.createWindow({
            url:"../newWindow.js",
            title:"newWindow"
    });

    Titanium.UI.currentTab.open(window,{animated:true});
});

既にここに投稿したように、MVC パターンを使用することをお勧めします。

于 2011-03-04T09:12:21.107 に答える
2

App.js ファイルは基本的に、さまざまなウィンドウ画面を初期化し、タブを使用してそれらのウィンドウ画面をロードするためのファイルです。簡単な画面を作成するためのリンクを次に示します。ウィンドウとタブの作成

TitaniumUIに関連するその他のプロパティについては、

于 2011-03-03T06:44:14.667 に答える
1

これを試してください:

app.js

Tintanium.include('window1.js', 'window2.js');

...

    var button1 = Titanium.UI.createButton({...});

button1.addEventListener('click',function(){
    window1.open();
    });

window1.js

var window1=Titanium.UI.createWindow({...});

...etc...

これが役立つことを願っています;)

于 2012-02-09T10:53:55.733 に答える
0

多くの時間をかけて調査した結果、ii はボタンにクリック イベントを関連付けて別のウィンドウを開くための解決策を見つけました。

従業員.js

//Current window (employee window)
var employeeWin = Ti.UI.currentWindow;

//define button
var moveToDetailBtn = Ti.UI.createButton({
   width      : 200,      //define the width of button
   height      : 50,      //define height of the button
   title         : 'Show Detail'   //Define the text on button
});

//Click event to open the Employee Details window
moveToDetailBtn.addEventListener('click', function(){

   //Call a export function
   var win = require('employeeDetails').getEmployeeDetailSWin;

   //Create new instance
   var employeeDetailsWin = new win();

   //Open the Employee Details window
   employeeDetailsWin.open();
});


//Add the button to the window
employeeWin.add(moveToDetailBtn);

employeeDetails.js 内

exports.getEmployeeDetailSWin = function(){

   //Creates a new window
   var empDetailsWin = Ti.UI.createWindow({
      backgroundColor   : '#ffffff'      //Define the backgroundcolor of the window
   });

   //Addin a label to the window
   empDetailsWin.add(Ti.UI.createLabel({
      width      : 100,      //Define width of the label
      height      : 50,      //Define height of the label
      title         : 'Employee Details'
   }));

   return empDetailsWin;
};

このページで解決策を見つけました: http://www.mindfiresolutions.com/Open-New-Window-Without-URL-Property-In-Titanium-2214.php

于 2012-12-24T19:16:16.287 に答える