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;
精彩评论