I want to insert images from array 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然后在选定的行中设置图像
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.