MonoTouch はsizeWithFont
を通じてメソッドを利用できるようにしますが、渡した文字列の長さに関係なくUIView
、フォントを返すようです。LineHeight
string someString = "test string";
UIFont someFont = UIFont.SystemFontOfSize(13f);
SizeF sizeToDisplay = someUIView.StringSize(someString, someFont, Bounds.Width, UILineBreakMode.WordWrap);
// sizeToDisplay = { Width: 58, Height = 16 }
someString = string.Join(" ", Enumerable.Repeat(someString, 500));
sizeToDisplay = someUIView.StringSize(someString, someFont, Bounds.Width, UILineBreakMode.WordWrap);
// sizeToDisplay = { Width: 304, Height = 16 }
テキストの任意のブロックを表示するために必要な高さを見つけるために使用する必要がある他の方法はありますUITextView
か?