首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >试图在SmartFace App中显示一个选择器{}

试图在SmartFace App中显示一个选择器{}
EN

Stack Overflow用户
提问于 2015-03-21 19:12:47
回答 1查看 119关注 0票数 0

我一直在使用来自SmartFace.io的示例代码,如下所示:

代码语言:javascript
复制
    pick(
    myCars,
    selectedIndex,
    function(e) {Pages.NewPage.Label1.text = myCars[e.index]; selectedIndex = e.index; },
    function() {},
    function() {}
 );

但是,选择器只是不想在模拟器中显示。我还尝试将这些代码放入一个分隔函数中,并从ImageButton的一个ImageButton事件中调用它,但仍然什么也没有。

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

对我所做的任何不正确的暗示都将不胜感激。

谢谢格里

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-23 07:00:36

我只需添加一个TextButton和标签到Page1并编写这些codeLines。它起作用了;也许,其他一些代码破坏了这些功能。

代码语言:javascript
复制
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() {}
 );
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29186897

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档