Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 单触式对话框多行元素高度未增长_C#_Ios_Xamarin.ios_Monotouch.dialog_Xamarin.mobile - Fatal编程技术网

C# 单触式对话框多行元素高度未增长

C# 单触式对话框多行元素高度未增长,c#,ios,xamarin.ios,monotouch.dialog,xamarin.mobile,C#,Ios,Xamarin.ios,Monotouch.dialog,Xamarin.mobile,我有一个简单的自定义多行元素,我将其换行模式设置为wordwrap,lines属性设置为7。我的文本似乎包裹得很好,但单元格高度保持不变,因此文本扩展了单元格的边界。我已经尝试增加单元格的帧并覆盖GetHeight,但在这两种情况下似乎都不起作用。而且,我的GetHeight似乎还没有被调用 有人面临类似的情况吗?或者有没有关于这个问题的想法 public class DisclaimerMultilineElement : MultilineElement { public Discl

我有一个简单的自定义多行元素,我将其换行模式设置为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;
    }
}

您需要在
UITableViewSource
中覆盖
GetHeightForRow
,并返回适当的高度。

确保在根元素中将
行设置为
true