[英]I have the cell displayed but I want the image to be displayed in the collection view cell when i press the button
我想在按下按鈕時從數組中插入圖像
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath)
cell.backgroundColor = UIColor.orangeColor()
return cell
}
func buttonCreateStickerPressed(sender: UIButton!){
let stickerName = "Sticker Number "+String(stickerDictionary.count+1)
let stickerNumber = stickerDictionary.count+1
makeSticker(stickerName, stickerNumber: stickerNumber)
// let count = stickerArray.count
}
您可以嘗試reloadData然后設置圖像,或者如果只對某些索引進行設置,則可以嘗試reloadDataForRowIndexes:columnIndexes然后在選定的行中設置圖像
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.