2

I use MonoTouch.Dialog (heavily customized) and I used the tableView's StringSize method to get the Size of a string (height and width). This doesn't work now in iOS 7. How can I return a Size of a string to get it's height/width so I can perform adjacent control alignments?

Thank you.

Neal
  • 9,487
  • 15
  • 58
  • 101
  • in Obj-C, but same basic question: http://stackoverflow.com/questions/18368567/uitableviewcell-with-uitextview-height-in-ios-7 – Jason Sep 29 '13 at 14:35

1 Answers1

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);
Larry OBrien
  • 8,484
  • 1
  • 41
  • 75