ronak patel
ronak patel

Reputation: 400

How to set an image into an NSCollectionView?

Below is my code:

var  arrCategory:[NSString] =
         ["Australia","Austria","Belgium","Brazil","Cameroon","Canada","Chile","China","Denmark","Argentina"]

The strings given in above array are the name of images.

Upvotes: 2

Views: 492

Answers (2)

Pragnesh Vitthani
Pragnesh Vitthani

Reputation: 2540

Replace your code with:

cell.imageView?.image = UIImage(named: "\(self.arrCategory[indexPath.row]).png")
cell.LblName.text = "\(self.arrCategory[indexPath.row])"

Upvotes: 3

ronak patel
ronak patel

Reputation: 400

My Question Of Answer i find out and is Here:

cell.imgView.image = NSImage(named:self.arrCategory[indexPath.item])
cell.lbl.stringValue =  arrlbl[indexPath.item] as String

Upvotes: 1

Related Questions