Skip to content

Instantly share code, notes, and snippets.

@h5y1m141
Created June 16, 2012 00:23
Show Gist options
  • Save h5y1m141/2939341 to your computer and use it in GitHub Desktop.
Save h5y1m141/2939341 to your computer and use it in GitHub Desktop.
// カレンダー生成 ロジックは以下URLを参考に作成
// http://blog.livedoor.jp/dankogai/archives/50978399.html
var exports = {
make:function(/*array*/ calendar){
var len = calendar.length;
var rows= [];
for(var i=0;i<len;i++){
var row = Ti.UI.createTableViewRow({
borderWidth:1,
height:30
});
if(calendar[i].day%2===0) {
row.backgroundColor = '#ededed';
}else{
row.backgroundColor = '#c6c6c6';
}
var dayNamesLabel = Ti.UI.createLabel({
width:30,
height:30,
left:0,
top:0,
textAlign:1,
font:{
fontSize:14
},
text:calendar[i].dayNames
});
var line = Ti.UI.createLabel({
backgroundColor: '#999',
width:1,
height:30,
top:0,
left:30
});
var dayLabel = Ti.UI.createLabel({
width:30,
height:30,
left:0,
top:0,
textAlign:1,
font:{
fontSize:14
},
text:calendar[i].day
});
//row.add(dayNamesLabel);
row.add(line);
row.add(dayLabel);
rows.push(row);
}
return rows;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment