Q:

How do we access image view of a cell in swift? 

I have a tableView in which I have 1 prototype cell.  I created a class called custom cell and made that tableView of that type.  I have an imageView on that cell.  I dynamically create number of cells. 
How do I access the imageView of that cell? 
What I have tried is:
for i in 0...tableView.numberOfSections-1
        {
            for j in 0...tableView.numberOfRowsInSection(i)-1
            {
                if let cell = tableView.cellForRowAtIndexPath(NSIndexPath(forRow: j, inSection: i)) {

                    cells.append(cell)
                }

            }
        }

Custom Cell class looks like:
import UIKit

class CustomCell: UITableViewCell {

    @IBOutlet weak var photo1: UIImageView! 
    @IBOutlet weak var photo2: UIImageView! 
    @IBOutlet weak var photo3: UIImageView! 
    @IBOutlet weak var photo4: UIImageView! 
    @IBOutlet weak var photo5: UIImageView! 

    @IBOutlet weak var name: UILabel! 

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}

However, I am unable to access imageView of second cell using
cells[2].imageView

Can anyone suggest how can I do that? 

A:

Uitableview lazily render views.because of this you should only iterate on visible cells. I advise you to focus on willDisplayCell delegate methods.