IHAQNormalCell.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // IHAQNormalCell.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/12.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. import TKSwitcherCollection
  10. class IHAQNormalCell: UITableViewCell {
  11. @IBOutlet weak var exchangeSwitch: TKExchangeSwitch!
  12. override func awakeFromNib() {
  13. super.awakeFromNib()
  14. // Initialization code
  15. // fillCode
  16. let bgLayer1 = CAGradientLayer()
  17. bgLayer1.colors = [UIColor(red: 0.01, green: 0.87, blue: 0.79, alpha: 1).cgColor, UIColor(red: 0, green: 0.76, blue: 0.63, alpha: 1).cgColor]
  18. bgLayer1.locations = [0, 1]
  19. bgLayer1.frame = CGRect(x: 0, y: 0, width: KSCREENWIDTH, height: self.contentView.bounds.size.height)
  20. bgLayer1.startPoint = CGPoint(x: 0.5, y: 0)
  21. bgLayer1.endPoint = CGPoint(x: 0.99, y: 0.99)
  22. self.contentView.layer.insertSublayer(bgLayer1, at: 0)
  23. // #05CFAB
  24. self.exchangeSwitch.onColor = UIColor(hexString: "#573F95")!
  25. }
  26. override func setSelected(_ selected: Bool, animated: Bool) {
  27. super.setSelected(selected, animated: animated)
  28. // Configure the view for the selected state
  29. }
  30. override var frame: CGRect{
  31. set(newFrame){
  32. var frame = newFrame
  33. frame.origin.x = frame.origin.x + 20 //递归
  34. frame.origin.y = frame.origin.y + 5
  35. frame.size.width -= 40
  36. frame.size.height -= 10
  37. super.frame = frame
  38. }
  39. get{
  40. return super.frame
  41. }
  42. }
  43. }