Exemple #1
0
 public CGPoint GetCoordinateFromIndex(int index)
 {
     using (var TextLayout = new NSLayoutManager())
     {
         TextLayout.AddTextContainer(TextContainer);
         TextStorage.AddLayoutManager(TextLayout);
         TextLayout.GlyphRangeForBoundingRect(new CGRect(CGPoint.Empty, TextContainer.Size), TextContainer);
         var glyphIndex = TextLayout.GlyphIndexForCharacterAtIndex(index);
         var p          = TextLayout.LocationForGlyphAtIndex((nint)glyphIndex);
         TextStorage.RemoveLayoutManager(TextLayout);
         TextLayout.RemoveTextContainer(0);
         return(p);
     }
 }