I just made a second UITableViewCell class, and my table view won’t see it when I try to instantiate it! Here’s my cell class:
import UIKit class RecordingCell: UITableViewCell { @IBOutlet var titleLabel: UILabel! var title : String = "" override func awakeFromNib() { super.awakeFromNib() // Initialization code title = titleLabel.text! titleAnimation() } func titleAnimation(){ print ("starting the animation function") UIView.animate(withDuration: 1.5, delay: 1.5, options: .curveEaseInOut, animations: { self.titleLabel.text! = "Recording in Progress" }, completion: nil) } }
It’s super simple and just something I’m playing with. And here’s how I’m filling the table view:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if videoURLS.count == 0{ selectButton.isEnabled = false let cell = tableView.dequeueReusableCell(withIdentifier: "emptyCell") return cell! } if tableView.numberOfRows(inSection: 0) == (videoURLS.count + 1){ if indexPath.row == 0{ let cell = self.tableView.dequeueReusableCell(withIdentifier: "recordingCell") as! RecordingCell return cell } if indexPath.row != 0{ selectButton.isEnabled = true let cell = self.tableView.dequeueReusableCell(withIdentifier: "videoCell") as! VideoCell cell.videoURL = videoURLS[indexPath.row - 1] cell.parent = self cell.setViews() cell.setString() cell.setDate() cell.setTitle() cell.setSize() cell.setJpg() return cell } } else{ selectButton.isEnabled = true let cell = self.tableView.dequeueReusableCell(withIdentifier: "videoCell") as! VideoCell cell.videoURL = videoURLS[indexPath.row] cell.parent = self cell.setViews() cell.setString() cell.setDate() cell.setTitle() cell.setSize() cell.setJpg() return cell } }
At line 11 it shows the error “Use of undeclared type RecordingCell.” I’ve tried resetting the target in the cell class, but it still doesn’t work.
Powered by WPeMatico