Appcelerator Titanium using common options for labels -


for ( = 0; < 10; i++) {     var ypos = 30;         var label1 = ti.ui.createlabel({             left : 0,             top : ypos ,             width: "50%",             backgroundcolor: "blue",             height: 20,             text: i.tostring(),             textalign: ti.ui.text_alignment_center         });      var label2 = ti.ui.createlabel({             left : "50%",             top : ypos ,             width: "50%",             backgroundcolor: "blue",             height: 20,             text: i.tostring(),             textalign: ti.ui.text_alignment_center         });       ypos += 30; }; 

i not use again , again following block of code in loop.

width: "50%", backgroundcolor: "blue", height: 20, text: i.tostring(), textalign: ti.ui.text_alignment_center 

i using alloy. assigned class below

var label2 = ti.ui.createlabel({             left : "50%",             top : ypos ,             class:"commonpro"         }); 

in .tss file

    ".commonpro":    {            width: "50%",            backgroundcolor: "blue",            height: 20,            text: "bla bla",            textalign: ti.ui.text_alignment_center     } 

also used classname:"commonpro" properties label nothing changed.

how approach must try?

thanks in advance.

try following

var labeloptions = {      left : 0,      width: "50%",      backgroundcolor: "blue",      height: 20,      textalign: ti.ui.text_alignment_center,      top  : 0,      text : '' }; ( = 0; < 10; i++) {     var ypos = 30;        labeloptions.top = ypos;     labeloptions.string = i.tostring();     var label1 = ti.ui.createlabel(labeloptions);     var label2 = ti.ui.createlabel(labeloptions);     ypos += 30; } 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -