hii, i have created my own customised keyboard(0-9) numbers only ....so to two of the labels i want to add image but unable to do it??
here is my code so far : var cellWidth = '32.5%'; var cellHeight = 62; var xSpacer = 1; var ySpacer = 1; var xGrid = 3; var yGrid = 4;
var tableData = [];
var colorSet = ["#D3D3D3"];
var colorSetIndex = 0;
var cellIndex = 1;
for (var y = 0; y < yGrid; y++) {
var thisRow = Ti.UI.createTableViewRow({
className : "grid",
layout : "horizontal",
height : cellHeight + (1 * ySpacer),
//selectedBackgroundColor : "red"
});
for (var x = 0; x < xGrid; x++) {
var thisView = Ti.UI.createView({
objName : "grid-view",
objIndex : cellIndex.toString(),
backgroundColor : colorSet[colorSetIndex],
left : ySpacer,
height : cellHeight,
width : cellWidth,
selectedBackgroundColor : "green"
});
var thisLabel = Ti.UI.createLabel({
color : "black",
font : {
fontSize : 25,
fontWeight : 'bold'
},
text: cellIndex.toString(),
touchEnabled : false,
});
if(cellIndex !=10&&cellIndex !=11&&cellIndex !=12){
thisLabel.text=cellIndex.toString();
}
else if(cellIndex==10){
thisLabel.text=null;
// what to write here to place an image to this label??
}
else if(cellIndex==11){
thisLabel.text="0";
}
else if(cellIndex==12) {
thisLabel.text=null;
}
thisView.add(thisLabel);
thisRow.add(thisView);
cellIndex++;
colorSetIndex++;
if (colorSetIndex === colorSet.length) {
colorSetIndex = 0;
}
}
tableData.push(thisRow);
}
var tableview = Ti.UI.createTableView({
data : tableData,
width : '100%',
height :'100%',
bottom :'5%',
top:'30%',
//left :'1%'
});
i want to place an image to this label..i have tried it with thisLabel.backgroundImage="/images/profile.jpg"...but unable to do it...there is no problem with the image size what to write here in the above code... /* else if(cellIndex==10){
thisLabel.text=null;
// what to write here to place an image to this label??
}*/