加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 18:10:37 所属栏目:百科 来源:网络整理
导读:我将EntryElement子类化,并在GetCell方法中设置了UILineBreakMode: public class EntryElementEnhanced : EntryElement,IElementSizing{ public EntryElementEnhanced(string caption,string placeholder,string value) : base (caption,placeholder,value)
我将EntryElement子类化,并在GetCell方法中设置了UILineBreakMode:
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;
    }
}

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

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

解决方法

EntryElement创建一个UITextField,它是一行 only控件.

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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读