我有一个简单的自定义多行元素,其换行模式我已设置为wordwrap,并且行属性设置为7.我的文本似乎包裹得很好,但单元格高度保持不变,因此文本扩展了单元格的边界.我已经尝试增加单元格的框架并覆盖GetHeight,但它似乎在两种情况下都不起作用.而且,似乎我的GetHeight似乎没有被调用.
任何人面对类似的东西?或者关于问题可能是什么的任何想法?
public class DisclaimerMultilineElement : MultilineElement
{
public DisclaimerMultilineElement (string caption) : base(caption)
{
}
public DisclaimerMultilineElement (string caption, string value) : base(caption, value)
{
}
public DisclaimerMultilineElement (string caption, NSAction tapped) : base(caption, tapped)
{
}
public override float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
var ht = base.GetHeight (tableView, indexPath);
//return base.GetHeight (tableView, indexPath);
return 400.0f;
}
public override UITableViewCell GetCell (MonoTouch.UIKit.UITableView tv)
{
UITableViewCell cell = base.GetCell (tv);
var frame = cell.Frame;
frame.Height = 300f;
//cell.Frame …Run Code Online (Sandbox Code Playgroud)