在这里,我有一个任务,如果我写代码就像年龄应该在DropdownList中绑定,如1947年到2016年
layout = new UICollectionViewFlowLayout
{
SectionInset = new UIEdgeInsets(20, 5, 5, 5),
MinimumInteritemSpacing = 5,
MinimumLineSpacing = 5,
ItemSize = new SizeF(100, 100),
};
collectionView = new UICollectionView(UIScreen.MainScreen.Bounds, layout);
collectionView.ContentSize = new CGSize(View.Frame.Size.Width, 150);
collectionView.BackgroundColor = UIColor.White;
source = new UICollectionViewDataSource();
collectionView.RegisterClassForCell(typeof(TextCell), TextCell.CellId);
collectionView.Source = source;
整天拍摄
答案 0 :(得分:3)
这可以通过javascript完成,例如:
<select id="year"></select>
的JScript:
var year = 1947;
var till = 2016;
var options = "";
for(var y=year; y<=till; y++){
options += "<option>"+ y +"</option>";
}
document.getElementById("year").innerHTML = options;