This repository was archived by the owner on Jun 24, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -247,7 +247,28 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender
247247
248248- (UIView *)hitTest : (CGPoint)point withEvent : (UIEvent *)event
249249{
250- [_backedTextInputView setSelectedTextRange: nil notifyDelegate: true ];
250+ if (!_backedTextInputView.isFirstResponder ) {
251+ [_backedTextInputView setSelectedTextRange: nil notifyDelegate: true ];
252+ } else {
253+ UIView *sub = nil ;
254+ for (UIView *subview in self.subviews .reverseObjectEnumerator ) {
255+ CGPoint subPoint = [subview convertPoint: point toView: self ];
256+ UIView *result = [subview hitTest: subPoint withEvent: event];
257+
258+ if (!result.isFirstResponder ) {
259+ NSString *name = NSStringFromClass ([result class ]);
260+
261+ if ([name isEqual: @" UITextRangeView" ]) {
262+ sub = result;
263+ }
264+ }
265+ }
266+
267+ if (sub == nil ) {
268+ [_backedTextInputView setSelectedTextRange: nil notifyDelegate: true ];
269+ }
270+ }
271+
251272 return [super hitTest: point withEvent: event];
252273}
253274
You can’t perform that action at this time.
0 commit comments