在MonoTouch.Dialog上,EntryElement可以是多行吗?

val*_*ero 6 c# xamarin.ios ios monotouch.dialog

我将EntryElement子类化,并UILineBreakMode在GetCell方法中设置如下:

public class EntryElementEnhanced : EntryElement, IElementSizing
{
    public EntryElementEnhanced(string caption, string placeholder, string value) : base (caption, placeholder, value) {}


    public float GetHeight(UITableView view, NSIndexPath indexPath)
    {
        return 100.0f; //arbitrary number just for testing
    }

    public override UITableViewCell GetCell (UITableView tv)
    {
        var cell = base.GetCell (tv);
        cell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
        cell.TextLabel.Lines = 0;


        return cell;
    }
}
Run Code Online (Sandbox Code Playgroud)

这似乎不会使输入单元格的文本被包装.我应该把它放在其他地方吗?

如果有人知道更好的方法,我想在更高层次上完成的是我想在MonoTouch.Dialog中创建相当于UITextArea的东西.

pou*_*pou 5

EntryElement创建一个UITextField其为一个线控制.

如果您需要多行,那么我建议您创建自己的行Element,例如MultilineEntryElement,并让它在UITextView内部使用.

您可以通过复制粘贴代码EntryElement或通过继承UIViewElement(或两者兼而有之)来完成此操作.