I am using a custom cell in my tableView but when I run i get the error which I have mentioned in my question.
self.districtTableView.register(UINib(nibName: "PlaceCollectionViewCell", bundle: nil), forCellReuseIdentifier: "placeCell") func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { return false } func textFieldDidEndEditing(_ textField: UITextField) { // TODO: Your app can do something when textField finishes editing print("The textField ended editing. Do something based on app requirements.") } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return districts.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "placeCell") as! PlaceTableViewCell // Set text from the data model cell.distLabel.text = districts[indexPath.row] cell.textLabel?.font = distTextField.font return cell
How can I get rid of this error. I have used different methods for registering a cell in table view. But it does not works. please help
Remove that will solve this issue.
You have to add gesture in xib by programatically way
In my case it was a view which was added outside the cell. It shouldn't have been there
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With