I have checked all identifiers name and also checked the its class' name and all. Below is my code and error.
class StoreInfoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var store : StoreInfo = StoreInfo()
@IBOutlet weak var storeInfoTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
storeInfoTable.register(UINib(nibName: "CustomStoreInfoTableOneViewCell", bundle: nil), forCellWithReuseIdentifier: "storeinfocell1")
storeInfoTable.delegate = self
storeInfoTable.dataSource = self
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = storeInfoTable.dequeueReusableCell(withIdentifier: "storeinfocell1", for: indexPath) as! CustomStoreInfoTableOneViewCell
cell.storeInfoImage.sd_setImage(with: URL(string: (store.imageurl)), placeholderImage: UIImage(named: "r1"), options: [.continueInBackground, .progressiveDownload], completed: nil)
cell.storeinfoName.text = store.storename
}
}
You are registered your nib with ( :forCellWithReuseIdentifier)
but your need to register your nib with ( : forCellReuseIdentifier)
. Please change your register line with this.
storeInfoTable.register(UINib(nibName: "CustomStoreInfoTableOneViewCell", bundle: nil), forCellReuseIdentifier: "storeinfocell1")