XXButton.swift 429 B

12345678910111213141516171819
  1. //
  2. // XXButton.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/13.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class XXButton: UIButton {
  10. override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
  11. let margin: CGFloat = 15
  12. let area = self.bounds.insetBy(dx: -margin, dy: -margin) //负值是方法响应范围
  13. return area.contains(point)
  14. }
  15. }