using CoreGraphics; using Foundation; NSString myString = new NSString("My text string"); UIFont myFont = UIFont.SystemFontOfSize(12f); // calculate the bounding rectangle for the string CGRect boundingRect = myString.GetBoundingRect( new CGSize(width: 100f, height: float.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, new UIStringAttributes() { Font = myFont }, null); // print out the dimensions of the bounding rectangle Console.WriteLine("Width: {0}, Height: {1}", boundingRect.Width, boundingRect.Height);In this example, we create an `NSString` object containing some text and then define a font to use for that text. We then call the `GetBoundingRect` method on our string, passing in the desired width and specifying `NSStringDrawingOptions.UsesLineFragmentOrigin` to indicate that the bounding rectangle should take into account line breaks. Finally, we print out the dimensions of the resulting bounding rectangle. Package/library: Xamarin.iOS.