MonoTouch.UIKit.UIView.StringSize Method

Deprecated in iOS7. Use NSString.GetBoundingRect (SizeF, NSStringDrawingOptions, UIStringAttributes,NSStringDrawingContext) instead.

Calculates the System.Drawing.SizeF of a single line of the specified string if it were rendered with the specified: font, width constraint, and line-break mode.

Syntax

[MonoTouch.ObjCRuntime.ThreadSafe]
public System.Drawing.SizeF StringSize (string str, UIFont font, float forWidth, UILineBreakMode breakMode)

Parameters

str
The string whose size is being calculated.
font
The font to be used in the size calculation.
forWidth
The maximum width to be used in the calculation.
breakMode
The line-break mode to be used in the calculation.

Returns

Returns the System.Drawing.SizeF of the first line of the specified string if it were rendered with the specified: font, width constraint, and line-break mode.

Remarks

Application developers can use this method to calculate text metrics. It does not render or otherwise change state in the MonoTouch.UIKit.UIView.

This method calculates the size that the first line of the str would require if rendered with the font, if the rendering were not allowed to exceed the width of forWidth. This method uses the specified lineBreakMode line-break mode to truncate the string when it exceeds forWidth. If the System.Drawing.SizeF.Height of the constrainedToSize argument is less than that of a single line of text in the specfied font, the method may return a System.Drawing.SizeF whose System.Drawing.SizeF.Height is greater than that in constrainedToSize.

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0