how to set value for uilable in swift?

0 votes
491 views
asked Nov 25, 2014 in Swift by kalpana (3,995 points)

Hi

  how to set value for uilable in swift?

I am using the follwoing code but its crashing? 

 

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("CollectionViewCell", forIndexPath: indexPath) as CollectionViewCell

        cell.backgroundColor = UIColor.redColor()

        cell.feedContentSnippet.text = "Beginning UICollectionView In iOS 6: Part 1/2" - > its crashing here

        //cell.textLabel?.text = "\(indexPath.section):\(indexPath.row)"

        //cell.imageView?.image = UIImage(named: "circle")

        return cell

    }

 

Custom class

class CollectionViewCell: UICollectionViewCell {

      @IBOutlet var feedContentSnippet: UILabel!

    @IBOutlet var feedMainImage: UIImageView!  

}

1 Answer

0 votes
answered Jan 7, 2015 by camal

Hi

  cell.textLabel?.text = @"Check"

...