I get the error stated in the topic for unknown reason as the cell I reference(in DownloadProfilePicture) is visible. Basically, I am trying to replicate/adapt what is done in LazyTableViewImages
override func viewDidLoad() { super.viewDidLoad() self.tableView.registerClass(topCell.self, forCellReuseIdentifier: "topCell") self.tableView.registerClass(contentCell.self, forCellReuseIdentifier: "contentCell") tableView.registerNib(UINib(nibName: "topCell", bundle: nil), forCellReuseIdentifier: "topCell") tableView.registerNib(UINib(nibName: "contentCell", bundle: nil), forCellReuseIdentifier: "contentCell") self.tableView.delegate = self self.tableView.dataSource = self } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let nodeCount = arrayOfPosts.count; let cell = UITableViewCell() tableView.dequeueReusableCellWithIdentifier("topCell", forIndexPath: indexPath) as! topCell if (nodeCount > 0) { if (indexPath.row % 2 == 0){ // Set up the cell representing the app var cell = tableView.dequeueReusableCellWithIdentifier("topCell", forIndexPath: indexPath) as! topCell let post = arrayOfPosts[indexPath.row] cell.userName.text = post.userName cell.timeSincePosted.text = post.timeSincePosted // Only load cached images; defer new downloads until scrolling ends if (post.profileImage == nil) { if (!tableView.dragging && !tableView.decelerating) { downloadProfileImage(post, indexPath: indexPath) return cell } // if a download is deferred or in progress, return a placeholder image cell.profileImage.image = UIImage(named: "titanic.jpg") } else { cell.profileImage.image = post.profileImage } return cell } func downloadProfileImage(post: Post, indexPath: NSIndexPath){ println(self.tableView.indexPathsForVisibleRows()) println(indexPath) let cell:topCell = self.tableView.cellForRowAtIndexPath(indexPath) as! topCell cell.profileImage.image = UIImage(named: "img1") } visiblePaths:
( "<NSIndexPath: 0x7888f7b0> {length = 2, path = 0 - 0}", "<NSIndexPath: 0x788a4d60> {length = 2, path = 0 - 1}" ) cell:
<NSIndexPath: 0x788a3c80> {length = 2, path = 0 - 1}
let cell = tableView.dequeueReusableCellWithIdentifier("topCell", forIndexPath: indexPath) as! topCelltopCellI initially think that is is a variable. Conventions do help.