ios - UICollectionView UIImageView images not appearing -
i'm having trouble getting images appear in uicollectionview. can see cells being created, , if set image manually through storyboard image appears, can't happen in code
the collection view uses custom cell, below
class cardslistcell: uicollectionviewcell { @iboutlet weak var image: uiimageview! override func awakefromnib() { super.awakefromnib() } }]
the image connected in storyboard , cell has correct class set
the code displaying image
override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> cardslistcell { let cell = collectionview.dequeuereusablecellwithreuseidentifier("cell", forindexpath: indexpath) cardslistcell // configure cell var card : card = self.fetchedresultscontroller.objectatindexpath(indexpath) card var img = uiimage(named: card.image) var imageview = uiimageview(image: img) cell.image = imageview return cell }
it looks image , image view being created can print them out
Comments
Post a Comment