2

改行モードをwordwrapに設定し、linesプロパティを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 = new System.Drawing.RectangleF(frame.X, frame.Y, frame.Width, frame.Height);
        cell.BackgroundColor = UIColor.Clear;
        cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (12);
        cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
        cell.TextLabel.Lines = 7;
        cell.TextLabel.TextAlignment = UITextAlignment.Left;
        cell.TextLabel.Text = Value;
        return cell;
    }
}
4

2 に答える 2

7

ルート要素で にUnevenRows設定されていることを確認してください。true

于 2013-02-04T14:21:11.807 に答える
2

GetHeightForRowをオーバーライドしてUITableViewSource、適切な高さを返す必要があります。

于 2013-02-04T14:06:02.927 に答える