FileFolderItemCell.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // FileFolderItemCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/9/19.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import CocoaLumberjack
  10. protocol FileFolderCellPassValueDelegate {
  11. func selectedCellPassValue(_ cell:FileFolderItemCell,f:OOFile)
  12. }
  13. class FileFolderItemCell: UITableViewCell {
  14. @IBOutlet weak var actionButton: UIButton!
  15. @IBOutlet weak var nameLabel: UILabel!
  16. var file:OOFile? {
  17. didSet {
  18. self.nameLabel.text = file?.name!
  19. }
  20. }
  21. var delegate:FileFolderCellPassValueDelegate?
  22. override func awakeFromNib() {
  23. super.awakeFromNib()
  24. actionButton.setImage(UIImage(named: "unselected"), for: UIControl.State())
  25. actionButton.setImage(UIImage(named: "unselected"), for: .highlighted)
  26. actionButton.setImage(UIImage(named: "selected"), for: .selected)
  27. // actionButton.setImage(UIImage(named: "selected"), forState: .Selected | .Highlighted)
  28. }
  29. override func setSelected(_ selected: Bool, animated: Bool) {
  30. super.setSelected(selected, animated: animated)
  31. // Configure the view for the selected state
  32. }
  33. @IBAction func selectedFolderCell(_ sender: UIButton) {
  34. DDLogDebug("action Button Clicked")
  35. sender.isSelected = !sender.isSelected
  36. if sender.isSelected {
  37. //选中传值到controller
  38. delegate?.selectedCellPassValue(self, f: file!)
  39. }
  40. }
  41. }