我如何在cellForItemAtIndexPath中使用for循环
这是我的代码,任何帮助?
我希望每个循环返回单元格
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell:CellCollectionView = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! CellCollectionView
for Restaurent1 in Resturent.Restaurants
{
var ResturentName = eachRestaurent.name
var ResturentDescrption = eachRestaurent.descrption
var ResturentId = eachRestaurent.id
cell.ResturentsName.text = ResturentName
cell.ResturentsDescrption.text = ResturentDescrption
cell.ResturentsId.text = String(ResturentId as! Int)
}
return cell
}
Run Code Online (Sandbox Code Playgroud)