我如何使用for循環內cellForItemAtIndexPath我怎樣才能在tableView中使用循環swift
這裏是我的代碼,任何幫助嗎?
我想回到小區每個循環
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
}
你必須有2個拼寫Restaurant'的',這兩者都不是正確的.. – MTCoster
在我的代碼不是,我寫了一個例子 –