在iOS 7中获取String的SIZE

Nea*_*eal 2 c# size xamarin.ios ios7

我使用MonoTouch.Dialog(大量定制),我使用tableView的StringSize方法来获取字符串的大小(高度和宽度).这在iOS 7中现在不起作用.如何返回字符串的大小以获得它的高度/宽度,以便我可以执行相邻的控制对齐?

谢谢.

Lar*_*ien 5

var tv = new UITextView() {
    Text = "Some text",
    Font = UIFont.PreferredBody
};
//Pass in a maximum size (in this case, vastly larger than needed)
var neededSize = tv.SizeThatFits(new SizeF(1000, 1000));
Console.WriteLine(neededSize);
Run Code Online (Sandbox Code Playgroud)