动态计算表中单元格cell的高度:
public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
var size = new CGSize(tableView.Bounds.Width, float.MaxValue);
var detailDict = new NSDictionary(UIStringAttributeKey.Font, UIFont.SystemFontOfSize(13));
var detailRect = ((NSString)“ 所要计算的字符串”.WeakGetBoundingRect(size, NSStringDrawingOptions.UsesLineFragmentOrigin, detailDict, null);
var detailHeight = detailRect.Size.Height;
var textDict = new NSDictionary(UIStringAttributeKey.Font, UIFont.SystemFontOfSize(15));
var textRect = ((NSString)“ 所要计算的字符串”.WeakGetBoundingRect(size, NSStringDrawingOptions.UsesLineFragmentOrigin, textDict, null);
var textHeight = textRect.Size.Height;
return detailHeight + textHeight + 30;
}