0

我一直在使用 SmartFace.io 中的示例代码进行如下工作:

    pick(
    myCars,
    selectedIndex,
    function(e) {Pages.NewPage.Label1.text = myCars[e.index]; selectedIndex = e.index; },
    function() {},
    function() {}
 );

然而,选择器只是不想在模拟器中显示。我还尝试将此代码放在一个单独的函数中,并从 ImageButton 的 OnPress 事件中调用它,但仍然没有。

我正在 iPhone 4S 上尝试这个,所以也许这就是问题所在......

任何关于我做错了什么的提示将不胜感激。

谢谢格里

4

1 回答 1

0

我只是将 TextButton 和 Label 添加到 Page1 并编写这些 codeLines。它有效;也许,其他一些代码破坏了这些功能。

var myCars = ["Audi", "Volvo", "Volkswagon"]; 
var selectedIndex = 0;

/**
* Creates action(s) that are run when the user press the key of the devices.
* @param {KeyCodeEventArguments} e Uses to for key code argument. It returns e.keyCode parameter.
* @this SMF.UI.Page
*/
function Page1_Self_OnKeyPress(e) {
    if (e.keyCode === 4) {
        Application.exit();
    }
}
/**
* Creates action(s) that are run when the page is appeared
* @param {EventArguments} e Returns some attributes about the specified functions
* @this SMF.UI.Page
*/
function Page1_Self_OnShow() {
    //Comment following block for removing navigationbar/actionbar sample
    //Copy this code block to every page onShow
    header.init(this);
    header.setTitle("Page1");
    header.setRightItem("RItem");
    header.setLeftItem();
    /**/
}
/**
* Creates action(s) that are run when the object is pressed from device's screen.
* @param {EventArguments} e Returns some attributes about the specified functions
* @this SMF.UI.TextButton
*/
function Page1_TextButton1_OnPressed(e){
      pick(
    myCars,
    selectedIndex,
    function(e) {Pages.NewPage.Label1.text = myCars[e.index]; selectedIndex = e.index; },
    function() {},
    function() {}
 );
}
于 2015-03-23T07:00:36.887 回答