Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. extension FollowUpController {
  2.  
  3. func numberOfSections(in collectionView: UICollectionView) -> Int {
  4. return self.followupArray.count
  5. }
  6.  
  7. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  8.  
  9. return self.followupArray[section].products.count
  10. }
  11.  
  12. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  13.  
  14. let cell = self.followUpView.collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! FollowUpCell
  15.  
  16. let product = followupArray[indexPath.section].products[indexPath.row]
  17.  
  18. let logSaleClosure = { () -> Void in
  19.  
  20. let alertMessage = UIAlertController(title: "Good Work", message: "You just sold 1 \(product)", preferredStyle: .alert)
  21. alertMessage.addAction(UIAlertAction(title: "Confirm sold item", style: .default, handler: nil))
  22.  
  23. self.present(alertMessage, animated: true, completion: nil)
  24.  
  25. }
  26.  
  27. cell.logButton.addTarget(self, action: #selector(FollowUpCell.didPressLogButton), for: .touchUpInside)
  28.  
  29. cell.phoneNameLabel.text = product.name
  30. cell.accruedPointsLabel.text = "\(product.value) points"
  31. cell.pointWorthLabel.text = "\(product.sales) points"
  32.  
  33. cell.colorLine.backgroundColor = UIColor(string: product.hexColor!)
  34. cell.logButton.titleLabel?.textColor = UIColor(string: product.hexColor!)
  35. cell.logButton.layer.borderColor = UIColor(string: product.hexColor!).cgColor
  36.  
  37. cell.logButton.setTitle("+", for: .normal)
  38.  
  39. return cell
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement