NSLayoutManager returns incorrect character index when tapping on LTR text in RTL attributed text
问题 I wrote code to detect if the user taps within a specific range in UILabel . It seems to be working in most cases, but I have noticed that tapping the last line of an attributed text creates inconsistent results. public static bool DidTapRange(this UITapGestureRecognizer recognizer, UILabel label, NSRange range) { using (var ts = new NSTextStorage()) { var lm = new NSLayoutManager(); var tc = new NSTextContainer(new CGSize(label.Frame.Width, double.MaxValue)); lm.AddTextContainer(tc); ts