vendredi 11 décembre 2020

How to stop UITableView scroll make glitch while I use If/ElseIf/Else statements?

Alright, I just hope that I just almost completed my fourth app for head the release on the App Store, but one thing I've noticed my app show UITableView has seems likely glitched itself. Unsure if it was a bug or not.

For example:

When I opened the Episodes View Controller, it was perfect! enter image description here

When you scroll down (free was passed out at the top of UITableView), then scroll up and it will see accessory view was showing up ERP (Early Read Pass) like this, but tap the cell in which available is, it will open the story expecting that accessory view seems likely bugs.

enter image description here

The code result here:

 // MARK: Countdown Cells
    
    if dateDifference <= 0 {
        
        // Avaiable
             cell?.EpisodeLBL?.text = "Epsoide \(indexPath.row + 1)"
         cell?.EpisodeLBL?.textColor = UIColor.white
         cell?.EpisodeLBL?.font = UIFont(name: SpaceFont, size: 22)
             cell?.EpisodeLBL.adjustsFontSizeToFitWidth = true

         cell?.accessoryType = .disclosureIndicator
             
        
    } else {
        
        // ERP
        cell?.EpisodeLBL?.text = "Epsoide \(indexPath.row + 1)"
        cell?.EpisodeLBL?.textColor = UIColor.white
        cell?.EpisodeLBL?.font = UIFont(name: SpaceFont, size: 22)
        cell?.EpisodeLBL.adjustsFontSizeToFitWidth = true
        
        let imageView = UIImageView(image: UIImage(systemName: "dollarsign.square.fill")?.withTintColor(UIColor.systemGreen))
        cell?.accessoryView = imageView
           
        
    }

I just thought if and else are a spilt group of the codes to make code to understand to force an app to do different path between free or paid (or an example: this or that group of codes) to make sure not same as well.

I discovered the code methods to way to stop glitch itself in the UItableView.

 if indexPath.row == /* numbers here of the cells */ {
        
        // Make force the cell to make focus on executing here. 
        
    }

I can't do it by many codes in each of them. How can I fix the issues from above?

Aucun commentaire:

Enregistrer un commentaire