Cell not displayed in collection view instantiated from storyboard (not embedded)

In the below scenario, I cannot get even the cell background (black) to show.

In a storyboard, I've a container with an embedded custom UICollectionView with a custom UICollectionViewCell with an image view as an outlet. In another View Controller, I've inserted a container where I want the same collection view and cell.

I seem to be able to instantiate the custom collection view and the cell (both print to console and don't return nil). The following code prints as below.

override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
{
    print("into the collectionView")
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier("photoCell" , forIndexPath: indexPath) as! PhotoCollectionViewCell

    cell.backgroundColor = UIColor.blackColor()
    let myRect = CGRect(x: 0, y: 0, width: 78, height: 78)
    cell.frame = myRect

    cell.autoresizesSubviews = false

    if let imageForCell = images?[indexPath.row]
    {
        cell.cellImageView.image = imageForCell
        print("cell image \(cell.cellImageView.image)")
    }
    print(cell.cellImageView?.bounds.size)
    cell.cellImageView?.layer.borderWidth = 1.0
    cell.cellImageView?.layer.borderColor = UIColor.blackColor().CGColor

    return cell
}

into the collectionView

cell image Optional(, {320, 213})

Optional((78.0, 78.0))

I've tried every suggested solution, but can't get the cell to show within the collection view.

Answers


embed controller with both container. so whatever you will do in controller then it will be reflected on both container


Need Your Help

Actionscript 3: How to have a keyboard Keystroke "Button" go to specific Frame FROM a specific Frame?

actionscript-3 flash button keyboard-events keystroke

I'm Super New to Programming in general and very New to Actionscript 3. It's been a rough but fun ride.

jQuery - traversing up one parent and setting the ID

javascript jquery

I'm trying to grab the text within a label - and traverse it up to the parent("li") and set it as an ID there.