0

Im looking to pass data from a collection view i have pulling data from parse to a new view. In the collection view i have it displaying a label called productName and an image called productImage. I'm looking to pass the Name, Image and a text view that will hold the product description to a view controller. Could someone please help me out with this?

Right now I'm getting this error when i click on the cell to go to the new view.

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful. 2015-07-14 18:57:03.248 CollectionViewBasic[13942:635684] Warning: Attempt to present on whose view is not in the window hierarchy!

any idea why?

rici
  • 234,347
  • 28
  • 237
  • 341
Tom F
  • 361
  • 1
  • 3
  • 7

1 Answers1

0

Your question is not clear, what is your specific problem? If you want to send data to another view controller, on the: didselectrowatindexpath method, call the performseguewithidentifier method.

then on prepareforsegue method, pass the data you want:

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
    let card = self.cards[indexPath.row] as! PFObject
    self.selectedCard = card
    self.performSegueWithIdentifier("toCardSegue", sender: self)
}

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "toCardView" {
        let controller = segue.destinationViewController as! CardImageViewController
        controller.cardToShow = self.selectedCard
    }
}

then on the viewdidload method of the next view controller you can access the cardToShow or whatever object you have passed on.

Hope it helps.

DanielEdrisian
  • 716
  • 1
  • 4
  • 17