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 }
我应该使用其他方法来查找在 a 中显示任意文本块所需的高度UITextView
吗?