NCTrashHeader.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // NCTrashHeader.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 09/10/2018.
  6. // Copyright © 2018 TWS. All rights reserved.
  7. //
  8. import Foundation
  9. class NCTrashHeader: UICollectionReusableView {
  10. @IBOutlet weak var tapSwitch: UIImageView!
  11. @IBOutlet weak var tapMore: UIImageView!
  12. @IBOutlet weak var separator: UIView!
  13. var delegate: NCTrashHeaderDelegate?
  14. override func awakeFromNib() {
  15. super.awakeFromNib()
  16. tapMore.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem)
  17. tapSwitch.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "more"), multiplier: 2, color: NCBrandColor.sharedInstance.optionItem)
  18. separator.backgroundColor = NCBrandColor.sharedInstance.seperator
  19. let tapGestureSwitch = UITapGestureRecognizer(target: self, action: #selector(NCTrashHeader.tapSwitch(sender:)))
  20. addGestureRecognizer(tapGestureSwitch)
  21. tapGestureSwitch.numberOfTapsRequired = 1
  22. tapSwitch.isUserInteractionEnabled = true
  23. tapSwitch.addGestureRecognizer(tapGestureSwitch)
  24. let tapGestureMore = UITapGestureRecognizer(target: self, action: #selector(NCTrashHeader.tapMore(sender:)))
  25. addGestureRecognizer(tapGestureMore)
  26. tapGestureMore.numberOfTapsRequired = 1
  27. tapMore.isUserInteractionEnabled = true
  28. tapMore.addGestureRecognizer(tapGestureMore)
  29. }
  30. @objc func tapSwitch(sender: UITapGestureRecognizer) {
  31. delegate?.tapSwitchHeader()
  32. }
  33. @objc func tapMore(sender: UITapGestureRecognizer) {
  34. delegate?.tapMoreHeader()
  35. }
  36. }
  37. protocol NCTrashHeaderDelegate {
  38. func tapSwitchHeader()
  39. func tapMoreHeader()
  40. }