UITableView not updating on reloadData - ios

I have two tableview on the screen. I have set delegate & datasource for both tableview. Lets have consider one table to show main filters & on click of particular cell/filter i have to reload subfilters in second tableview.
So i tried very simple solutions, didSelectRowAt,
subfilterTableView.reloadData()
Even i have tried by calling on main thread too,
DispatchQueue.main.async {
subfilterTableView.reloadData()
}
Still its not reloading the subfilterTableView.
I know this beginUpdates() & endUpdates() method are only for to insert & delete cells still i have reload in between beginUpdates() & endUpdates() it make crash as it is accepted.
I know this is stupid question but i have tried every possible simpler solutions.
Following are the some conditions which i come across:
Sometime data get populated on second click
Sometime data get populated after 3-5 seconds
Data get populated on refresh of tableview too
irony is Data get properly populated on real device
Following is my code:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView.tag == 1 {
return filters.count
}
else{
return subFilters.count
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if tableView.tag == 1 {
let filter = filters[indexPath.row]
let cell = tableView.dequeueReusableCell(withIdentifier: "FilterTableViewCell", for: indexPath) as! FilterTableViewCell
cell.labelFilter.text = filter["filterName"] as? String
cell.backgroundColor = UIColor.clear
cell.preservesSuperviewLayoutMargins = false
cell.separatorInset = UIEdgeInsets.zero
cell.layoutMargins = UIEdgeInsets.zero
cell.selectionStyle = .none
return cell
}
else{
let cell = tableView.dequeueReusableCell(withIdentifier: "SubFilterTableViewCell", for: indexPath) as! SubFilterTableViewCell
cell.labelSubfilter.text = subFilters[indexPath.row]
cell.backgroundColor = UIColor.clear
cell.selectionStyle = .none
return cell
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if tableView.tag == 1 {
let selectedCell:FilterTableViewCell = tableView.cellForRow(at: indexPath)! as! FilterTableViewCell
selectedCell.labelFilter.textColor = UIColor.black
selectedCell.contentView.backgroundColor = UIColor.white
subFilters = filters[indexPath.row]["subFilterValue"] as! [String]
self.tableViewSubfilters.reloadData()
// DispatchQueue.main.async {
// self.tableViewSubfilters.reloadData()
// }
// tableViewSubfilters.performSelector(onMainThread: #selector(self.reloadData), with: nil, waitUntilDone: true)
}
}

It seems that your code does not have any issue
Just run it on real device instead of simulator

Do check the Datasource and Delegates of your second tableview.
subfilterTableView.dataSource = self
subfilterTableView.delegate = self

Put in viewDidLoad():
func viewDidLoad() {
tableView.delegate = self
tableView.datasource = self
}

Related

How to add UISwitch to a specific UITableView cell programmatically

I am relatively new to UIKit. Currently, I am trying to create a UISwitch that will show up on a specific UITableView cell. However, I can't seem to figure out how to do this. Instead, I am getting a UISwitch on every single cell in the UITableView.
My code is below:
import UIKit
class SettingsVC: UIViewController {
var tableView = UITableView(frame: .zero, style: .insetGrouped)
let cells = ["Change Accent Color", "Change Currency Symbol", "Vibrations"]
let cellReuseIdentifier = "cell"
override func viewDidLoad() {
super.viewDidLoad()
createTableView()
setTableViewDelegates()
}
func createTableView() {
view.addSubview(tableView)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier)
tableView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: view.topAnchor),
tableView.leftAnchor.constraint(equalTo: view.leftAnchor),
tableView.rightAnchor.constraint(equalTo: view.rightAnchor),
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
}
func setTableViewDelegates() {
tableView.delegate = self
tableView.dataSource = self
}
}
extension SettingsVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cells.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell") else {
return UITableViewCell()
}
cell.textLabel?.text = cells[indexPath.row]
let switchView = UISwitch(frame: .zero)
switchView.setOn(false, animated: true)
cell.accessoryView = switchView
return cell
}
}
This is how my UITableView looks currently in the simulator.
This is how I would like the UITableView to look.
How would I be able to achieve the look I'm going for? Any help would be greatly appreciated.
The method tableView(_:cellForRowAt:) is used to create all cells for a table, so the code inside this method is called for each cell. You need to figure out a condition that distinguishes the cell with a UISwitch and run the corresponding piece conditionally. Conceptually, something like this:
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell") else {
return UITableViewCell()
}
cell.textLabel?.text = cells[indexPath.row]
if isSwitchNeeded { // Here.
let switchView = UISwitch(frame: .zero)
switchView.setOn(false, animated: true)
cell.accessoryView = switchView
}
return cell
}
There are some architectural options that might allow you do that. One of them is to rely on the index path. For instance, this should work in your raw example:
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell") else {
return UITableViewCell()
}
cell.textLabel?.text = cells[indexPath.row]
if indexPath.row == 2 {
let switchView = UISwitch(frame: .zero)
switchView.setOn(false, animated: true)
cell.accessoryView = switchView
}
return cell
}
And a million other ways.
First of all most likely you want to save the value of the switch, so create a property on the top level of the view controller
var enableVibrations = false
Second of all cells are reused. Even if there are only three cells it's good practice to set all UI elements to a defined state, that means to set the accessory view to nil if there is no switch.
And there is a dequeueReusableCell API which returns a non-optional cell.
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let title = cells[indexPath.row]
cell.textLabel?.text = title
if title == "Vibrations" {
let switchView = UISwitch(frame: .zero)
switchView.setOn(enableVibrations, animated: true)
switchView.addTarget(self, action: #selector(toggleVibrations), for: .valueChanged)
cell.accessoryView = switchView
} else {
cell.accessoryView = nil
}
return cell
}
And add the action method
#objc func toggleVibrations(_ sender : UISwitch) {
self.enableVibrations = sender.isOn
}

weird tableview behavior when cell is selected

My tableview has a weird behavior when a cell is selected but this behavior is not seen always. When a cell has been selected some cells which are below the selected cell moves. These two gifs will show you the behavior in the two cases when it is shown and when it doesn't appear.
this is the
tableview without weird behavior and this is the tableview with the weird behavior
and this is my code :
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell : UserTableViewCell = (tableView.dequeueReusableCell(withIdentifier: "userCell") as? UserTableViewCell)!
if(self.firebaseUsers.count != 0){
cell.influentBackgroudView.layer.cornerRadius=10
let url = URL.init(string: String().loadCorrectUrl(url:firebaseUsers[indexPath.row].image))
cell.influentImageView.contentMode = .scaleAspectFit
cell.influentImageView!.sd_setImage(with: url!, placeholderImage: UIImage.init(named: "placeholder"),options: [.continueInBackground,.progressiveDownload], completed: { (image, error, cacheType, imageURL) in
if (error != nil) {
cell.influentImageView!.image = UIImage(named: "placeholder")
} else {
cell.influentImageView.contentMode = .scaleAspectFill
cell.influentImageView.image = image
}
})
cell.influentImageView.layer.cornerRadius=10
cell.influentImageView.layer.masksToBounds = true
cell.influentNameLabel.text=" " + firebaseUsers[indexPath.row].name + " "
cell.influentNameLabel.adjustsFontSizeToFitWidth = true
cell.influentNameLabel.textAlignment = .center
if(selectedCellIndex==indexPath ){
cell.influentBackgroudView.isHidden=false
}
else{
cell.influentBackgroudView.isHidden=true
}
cell.selectionStyle = .none
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let previousIndex=selectedCellIndex
selectedCellIndex=indexPath
if(previousIndex==selectedCellIndex){
let nextVC = storyboard?.instantiateViewController(withIdentifier: "VisitedProfileViewController") as! VisitedProfileViewController
nextVC.passedUser = firebaseUsers[selectedCellIndex!.row]
navigationController?.pushViewController(nextVC, animated: true)
}
if(previousIndex==nil){
tableView.reloadRows(at: [indexPath], with:.none)
}
else{
if(previousIndex != indexPath){
tableView.reloadRows(at: [indexPath,previousIndex!], with: .none)
}
else {
tableView.reloadRows(at: [indexPath], with: .none)
}
}
}
thank you guys for your help!
As identified from the comments the issue you are facing is produced by calling reloadRows when you press a cell with conjunction of incorrect estimated row heights. So either reloading needs to be removed or estimated height corrected. The first solution is already covered in an answer provided by A. Amini.
Since many of such anomalies are related to estimated row height it still makes sense to improve it.
For simple static row heights you can either implement a delegate method for instance
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return indexPath.row == 0 ? 44.0 : 200.0
}
where the values are exactly the same as in your heightForRowAt method. Or if all rows have same hight you can remove this delegate method but set the heights directly in some initialization method like:
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = 200
tableView.estimatedRowHeight = tableView.rowHeight
}
When more complicated cells are introduced and automatic cell height is used we usually use a height cache of cells. It means we need to save height of a cell when it disappears so we may use it later. All heights are saved in a dictionary of type [IndexPath: CGFloat]. A very simple implementation should look like this:
private var cellHeightCache: [IndexPath: CGFloat] = [IndexPath: CGFloat]()
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cellHeightCache[indexPath] = cell.bounds.height
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return cellHeightCache[indexPath] ?? UITableView.automaticDimension
}
In some cases extra work is needed like clearing the cache when table view is reloaded.
The reason why this is happening is because table view will not reload cells around the cells you currently see but rather check the content offset and compute which cells you were supposed to be seeing. So any call to reload may make the table view jump or animate cells due to wrong estimated row height.
The main problem was you're reloading tableView after "each" selection.
Try this code out and let me know if you need more help.
class MyTableViewClass: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "userCell" as! UserTableViewCell
if !self.firebaseUsers.isEmpty {
cell.influentBackgroudView.layer.cornerRadius = 10
cell.influentImageView.contentMode = .scaleAspectFit
let url = URL(string: firebaseUsers[indexPath.row].image)
cell.influentImageView!.sd_setImage(with: url!, placeholderImage: UIImage(named: "placeholder"),options: [.continueInBackground,.progressiveDownload], completed: { (image, error, cacheType, imageURL) in
if error != nil {
cell.influentImageView.contentMode = .scaleAspectFill
}
})
cell.influentImageView.layer.cornerRadius=10
cell.influentImageView.layer.masksToBounds = true
cell.influentNameLabel.text = " \(firebaseUsers[indexPath.row].name) "
cell.influentNameLabel.adjustsFontSizeToFitWidth = true
cell.influentNameLabel.textAlignment = .center
cell.selectionStyle = .none
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let nextVC = storyboard?.instantiateViewController(withIdentifier: "VisitedProfileViewController") as! VisitedProfileViewController
nextVC.passedUser = firebaseUsers[indexPath.row]
navigationController?.pushViewController(nextVC, animated: true)
}
}
class UserTableViewCell: UITableViewCell {
override var isSelected: Bool {
didSet {
if isSelected {
// Selected behavior, like change Background to blue
} else {
// Deselected behavior, change Background to clear
}
}
}
}

UITableView background colour for bottom 5 rows

I do know how to input background colours for my row, but I don't really know how I can filter it by only the bottom 5 rows are "cell.backgroundColor = UIColor.red;" whereas the rest stays the same. Appreciate those who can help me this thanks!
P.S: Sorry as my swift is quite rusty.
UITableView Controller
import UIKit
import FirebaseDatabase
var postData2 = [String]()
var postData3 = [String]()
var tableDataArray = [tableData]()
class ResultsController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
ref = Database.database().reference() //set the firebase reference
// Retrieve the post and listen for changes
databaseHandle = ref?.child("Posts3").observe(.value, with: { (snapshot) in
postData2.removeAll()
postData3.removeAll()
tableDataArray.removeAll()
for child in snapshot.children {
let snap = child as! DataSnapshot
let key = snap.key
let value = String(describing: snap.value!)
let rating = (value as NSString).integerValue
postData2.append(key)
postData3.append(value)
tableDataArray.append(tableData(boothName: key, boothRating: rating))
}
postData2.removeAll()
postData3.removeAll()
let sortedTableData = tableDataArray.sorted(by: { $0.boothRating > $1.boothRating })
for data in sortedTableData {
postData2.append(data.boothName)
let value = String(describing: data.boothRating)
postData3.append(value)
}
self.tableView.reloadData()
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return postData2.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.font = UIFont.init(name: "Helvetica", size: 23)
cell.textLabel?.text = postData2[indexPath.row]
cell.detailTextLabel?.text = postData3[indexPath.row] + " ♥"
cell.detailTextLabel?.textColor = UIColor.red;
cell.detailTextLabel?.font = UIFont.init(name: "Helvetica", size: 23)
// cell.backgroundColor = UIColor.red;
return cell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
return 80
}
}
class tableData {
var boothName: String
var boothRating: Int
init(boothName: String, boothRating: Int) {
self.boothName = boothName
self.boothRating = boothRating
}
}
A simple way is to have an conditional check to see if the indexPath.row value is within the last five.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if(indexPath.row >= postData2.count-5){
cell.backgroundColor = UIColor.red
}else{
cell.backgroundColor = UIColor.white /* Remaining cells */
}
return cell
}
Some of the other answers will work - but it is nicer to use cells that have a known configuration when they are dequeued by cellForRowAt, not deal with a bunch of possible starting conditions each time you dequeue a cell. To do this subclass the UITableViewCell and override prepareForReuse(). This function will be called just before a cell is returned by dequeueReusableCell. Then cells can be set to a known starting point before you configure them. If cells could be received configured any possible way in cellForRowAt, you soon wind up with a very long function with a lot of if/else conditions.
The condition
if indexPath.row >= postData2.count - 5 {
cell.backgroundColor = UIColor.red
}
can be used as it is, and prepareForReuse takes care of the cells not keeping any settings when they are recycled. Here's an example:
override func prepareForReuse() {
super.prepareForReuse()
backgroundColor = UIColor.white
}
With this one simple setting it's a wash whether you do the if/else approach or use subclassing to make the most of prepareForReuse. But as soon as you have more than one thing to set in a cell you will find it is far less complex to use this function and results in far fewer mistakes with the appearance of cells - consider what would happen if there were more than one possible color a cell could be, or there were multiple elements in the cell to be configured with multiple possible values...
You can add simple logic
if indexPath.row >=(postData2.count-5) {
cell.backgroundColor = UIColor.red
}else {
cell.backgroundColor = UIColor.white
}
Just check a condition for setting the red colour for last five rows.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if(indexPath.row >= postData2.count-5){
cell.backgroundColor = UIColor.red;
}else {
cell.backgroundColor = UIColor.white; //white colour for other rows
}
return cell
}
This method is recommended by the system, this method is more circumventing reuse in some cases (like when you modify the contents of a control in the cell surface)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell: UITableViewCell? = tableView.dequeueReusableCell(withIdentifier: "cell")
// Not the type of cell, if the queue will return nil, at this time requires create ⼀ cell
if cell == nil {
cell = UITableViewCell(style: .default, reuseIdentifier: "cell")
}
}
If it involves data processing, you can create a new NSMutableSet(), Used to store your operations (ordinary data is lost, stored in the didSelecetRow inside indexPath like) save anyway, a unique tag.
These are just solve the problem of multiplexing, to deal with discoloration, refer to the above solution.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
if(indexPath.row >= postData2.count-5){
cell.backgroundColor = UIColor.red
}else{
cell.backgroundColor = UIColor.white /* Remaining cells */
}
return cell
}

Why is the top tableViewCell gray?

I am working with a UITableView in a normal UIViewController. For some reason, the text of the top cell in my TableView is always colored gray.
I have been trying to figure out what causes that cell to be gray, but don't know what it is. The data in my tableView is sourced from an array called fileList that gets refreshed during both viewWillAppear and viewDidAppear.
Why is the top cell always gray with this code?
(And it does happen both with nothing in the fileList and with many things in the fileList)
//MARK: - TableView
extension ViewController: UITableViewDataSource, UITableViewDelegate {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if fileList.count == 0 {
return 1
} else {
return fileList.count
}
}
internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if fileList.count == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.isUserInteractionEnabled = false
cell.accessoryType = UITableViewCellAccessoryType.none
cell.textLabel?.text = "No documents found"
cell.textLabel?.textAlignment = .center
cell.textLabel?.textColor = UIColor.black
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.isUserInteractionEnabled = true
cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
cell.textLabel?.text = (fileList[indexPath.row])
cell.textLabel?.textAlignment = .left
cell.textLabel?.textColor = UIColor.black
return cell
}
}
}
There is no issue running your code , It's running fine for me.
Even setting cell.selectionstyle = .grey is not putting grey color to cell or text.
You have to be more clear about question .
1) What is grey? text color or cell color.
2) What is the code that you are hiding or doing else apart?
extension ViewController : UITableViewDelegate,UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return fileList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")
let rowData = fileList[indexPath.row]
cell?.textLabel?.text = rowData
//cell?.isSelected = true
cell?.selectionStyle = .gray
cell?.isUserInteractionEnabled = true
cell?.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
cell?.textLabel?.textAlignment = .left
cell?.textLabel?.textColor = UIColor.black // if let priceString = rowData[2] as? String { cell.priceLabel.text = "Price: $(priceString)" }
return cell!
}
// Number of sections in table
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}// Default is 1 if not implemented
}
I believe this is the same as the problem mentioned here. Try setting:
cell?.textLabel?.isEnabled = true`
in the if statement block for fileList.count == 0 after the line
cell.isUserInteractionEnabled = false

How do I clear all checks in UITableVIew when VC is returned to from another VC?

I have a scenario where a UITableView shows a list of players in a league.
The user selects two players to compare results. As a user selects a player a check is shown. Once the user has selected two users a new VC is presented, showing the results of the two players.
On this ResultsVC I have a back button which dismisses ResultsVC, and the view is returned to the originalVC.
Upon returning to this originalVC the checks next to the players which were selected for viewing are still visible.
How do I reset all checks when this VC is returned to?
This is my code for the original VC with the TableView:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "PersonalStatsTableViewCell", for: indexPath as IndexPath) as! PersonalStatsTableViewCell
cell.textLabel?.text = self.communityPlayers[indexPath.row]
cell.textLabel?.font = UIFont(name: "Avenir", size: 12)
cell.textLabel?.textColor = UIColor.white // set to any colour
cell.layer.backgroundColor = UIColor.clear.cgColor
cell.personalStatsInfoButton.tag = indexPath.row
cell.personalStatsInfoButton.addTarget(self, action: #selector(infoClicked), for: UIControlEvents.touchUpInside)
cell.selectedBackgroundView?.backgroundColor = UIColor.red
return cell
}
func infoClicked(sender:UIButton){
let buttonRow = sender.tag
self.friendId = self.communityPlayerIds[buttonRow]
self.personalSelf = false
self.friendName = self.communityPlayers[buttonRow]
self.performSegue(withIdentifier: "personalStatsSegue", sender: self)
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.selectedCellTitle = self.communityPlayers[indexPath.row]
cellId = indexPath.row
//print (self.communityPlayerIds[indexPath.row])
if let cell = tableView.cellForRow(at: indexPath) {
if cell.isSelected {
cell.accessoryType = .checkmark
}
}
if let sr = tableView.indexPathsForSelectedRows {
print("didSelectRowAtIndexPath selected rows:\(sr)")
if sr.count == 2{
let tempId_1 = sr[0][1]
let tempId_2 = sr[1][1]
self.tempCount = 2
self.tempPlayerId_1 = self.communityPlayerIds[tempId_1]
self.tempPlayerId_2 = self.communityPlayerIds[tempId_2]
print ("you have selected player I'ds: ", self.tempPlayerId_1!, "and ", self.tempPlayerId_2!)
self.performSegue(withIdentifier: "showHeadToHeadSegue", sender: self)
}
}
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath as IndexPath) {
cell.accessoryType = .none
}
if let sr = tableView.indexPathsForSelectedRows {
print("didDeselectRowAtIndexPath selected rows:\(sr)")
}
}
}
I have read around the subject but nothing appears to work.
sussed it.
I added
cell.accessoryType = .none
into the func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell function
Then when the view is returned all checks are removed.

Resources