NXTextBubbleView.swift 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // NXTextBubbleView.swift
  3. // bubbleLayer_swift
  4. //
  5. // Created by liuming on 2020/8/23.
  6. // Copyright © 2020 liuming. All rights reserved.
  7. //
  8. import SnapKit
  9. import UIKit
  10. class NXTextBubbleView: NXNormalBubbleView {
  11. public let textLabel = UILabel(frame: .zero)
  12. override init(frame: CGRect) {
  13. super.init(frame: frame)
  14. initSubViews()
  15. }
  16. required init?(coder _: NSCoder) {
  17. fatalError("init(coder:) has not been implemented")
  18. }
  19. private func initSubViews() {
  20. containView.addSubview(textLabel)
  21. textLabel.snp.makeConstraints { make in
  22. make.edges.equalTo(UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5))
  23. }
  24. }
  25. // MARK: - 重写交互层的长按和点击事件
  26. override public func tapGestureRecognizerHandler(sender _: UITapGestureRecognizer) {
  27. print("点击了文字气泡")
  28. }
  29. override public func longGestureRecognizerHandler(sender _: UILongPressGestureRecognizer) {
  30. print("长按了 点击了文字气泡")
  31. }
  32. }