【问题标题】:Xamarin: Set UITextField HeightXamarin:设置 UITextField 高度
【发布时间】:2014-05-22 19:01:56
【问题描述】:

如何在 Xamarin iOS 中更改文本字段的高度?

在原生 iOS 中,您可以手动设置 UITextField 插座的高度,例如在 this answer 中,但在 Xamarin 中,它不允许您更改该属性。这在 Xamarin 中使用实际的 UITextField 是否可行?如果没有,获得类似东西的最佳技巧是什么?

【问题讨论】:

    标签: c# ios xamarin.ios uitextfield xamarin


    【解决方案1】:

    C# 中的 RectangleF 是一个结构,因此您需要复制它,更改值并将其设置回控件。​​

            var f = textField.Frame;
    
            f.Height = 100f;
    
            textField.Frame = f;
    

    【讨论】:

      【解决方案2】:

      你试过这样设置框架吗?

      textField.Frame = new RectangleF (x, y, width, height);
      

      【讨论】:

        【解决方案3】:

        UsernameText.Frame = new CoreGraphics.CGRect(UsernameText.Frame.X, UsernameText.Frame.Y,UsernameText.Frame.Width, UsernameText.Frame.Height + 5);

        【讨论】:

          猜你喜欢
          • 2012-01-28
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-10-24
          • 1970-01-01
          • 2011-02-01
          • 2019-04-22
          • 2021-03-07
          相关资源
          最近更新 更多