开发者

Appcelerator. Using factories but cannot access textfield values

开发者 https://www.devze.com 2023-03-19 14:23 出处:网络
I am developing an iOS app using appcelerator and I am trying to use JavaScript factories to seperate design (UI) from functions.

I am developing an iOS app using appcelerator and I am trying to use JavaScript factories to seperate design (UI) from functions.

I made a component that shows a textfield in a fancy way (code located in ui.js). You can view the code here: http://pastie.org/2188537.

I then call the component like this on another page.

var desc = ambadooUI.createTextField({

    hinttext: 'Label (Personal/Work/Gmail...)',
    vertical: 10,
    container: 'top'

});

The problem is now that I cannot access the data/value of开发者_如何转开发 the textfield. How can I do it? Am I forced to use custom events?

Thankful for all input!


just add the textField object as a property of the object you are returning.

for example at line 44, ui.js, you can do something like

// Return the finished button
top.text_field = textfield;
return top;
0

精彩评论

暂无评论...
验证码 换一张
取 消