Advertisement
Don_Mag

Untitled

Jun 23rd, 2023
1,669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.11 KB | None | 0 0
  1.  
  2.     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  3.        
  4.         let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! LessonsVCCell
  5.  
  6.         // set cellTitle label text
  7.         cell.cellTitle.text = lessonsArray[indexPath.row].name
  8.        
  9.         // set cellDescription label text
  10.         cell.cellDescription.text = lessonsArray[indexPath.row].details
  11.        
  12.         if lessonsArray[indexPath.row].blocked == 1 {
  13.            
  14.             // show cellImg view - does it get hidden somewhere ???
  15.             cell.cellImg.isHidden = false
  16.            
  17.             // show cellBtn button
  18.             cell.cellBtn.isHidden = false
  19.            
  20.             //set cellImg image
  21.             cell.cellImg.image = UIImage(systemName:"lock.fill")
  22.            
  23.             // create a new UIImageView, set its "color" -- but then do nothing with it ????
  24.             let cellImg = UIImageView(image: UIImage(named: "your_image_name"))
  25.             cellImg.setImageColor(color: UIColor.systemOrange)
  26.            
  27.         } else {
  28.            
  29.             // hide cellBtn button
  30.             cell.cellBtn.isHidden = true
  31.            
  32.             //set cellImg image
  33.             cell.cellImg.image = UIImage(named:"RightAnswerNew")
  34.            
  35.         }
  36.        
  37.         return cell
  38.        
  39.     }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement