Skip to content

Commit

Permalink
Fix aroundEvent distribution cant tap segment
Browse files Browse the repository at this point in the history
  • Loading branch information
iWECon committed Aug 11, 2023
1 parent 89c7de4 commit ce9b5a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Demo/Segmenter/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class ViewController: UIViewController {
)
}

@objc func buttonAction(_ sender: UIButton) {
print(sender.title(for: .normal) as Any)
}

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
Expand All @@ -66,6 +70,7 @@ class ViewController: UIViewController {
btn.setTitle(title, for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 12, weight: .medium)
btn.setTitleColor(.systemBlue, for: .normal)
btn.addTarget(self, action: #selector(buttonAction(_:)), for: .touchUpInside)
return .view(btn, verticallyOffset)
}

Expand Down
8 changes: 7 additions & 1 deletion Sources/Segmenter/Segmenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ public final class Segmenter: UIControl {
}

public func reloadSupplementaryViews() {
// hidden supplementaryView when it is empty
if !isAllOfOne, !isIndependentControls {
supplementaryView.isHidden = true
return
}
supplementaryView.isHidden = false
guard isAllOfOne || isIndependentControls else { return }

// load sub supplmentaryViews
Expand Down Expand Up @@ -761,7 +767,7 @@ public final class Segmenter: UIControl {
let inSupplementaryContainerInvalidFrame = supplementaryContainerInvalidFrame.contains(point)

if inSupplementaryContainerInvalidFrame {
responderView = scrollContainer
responderView = scrollContainer.hitTest(convert(point, to: scrollContainer), with: event)
} else {
let inSupplementaryView = supplementaryView.frame.contains(point)
if inSupplementaryView {
Expand Down

0 comments on commit ce9b5a1

Please sign in to comment.