Guest User

Untitled

a guest
Nov 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  2.  
  3.  
  4. if indexPath.row + 1 < EnabledID {
  5.  
  6. cell.backgroundView = UIImageView(image: UIImage(named: "CorrectMark"))
  7. cell.isUserInteractionEnabled = false
  8. cell.cellLabel.text = ""
  9. QV.score += 2
  10. QV.lblScoreCoins.text = String(score)
  11. UserDefaults.standard.set(lblScoreCoins.text, forKey: "Key")
  12. UserDefaults.standard.synchronize()
  13. lblScoreCoins.text = UserDefaults.standard.string(forKey: "Key")
  14.  
  15. }
  16.  
  17. return cell
  18. }
  19.  
  20. func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  21.  
  22. let QV : QuestionView = self.storyboard?.instantiateViewController(withIdentifier: "QuestionView") as! QuestionView
  23. QV.idFromCollection = indexPath.row + 1
  24.  
  25. self.present(QV, animated: true, completion: nil)
  26.  
  27. QV.lblScoreCoins.text = UserDefaults.standard.string(forKey: "Key")
  28.  
  29.  
  30. }
Add Comment
Please, Sign In to add comment