【问题标题】:How to add Top Padding in my textField (Objective-c)如何在我的文本字段中添加顶部填充(Objective-c)
【发布时间】:2020-02-26 19:00:06
【问题描述】:

我有 textField、CustomClass。

但我不知道如何使用 Insets。我知道函数但不知道如何使用它们。

【问题讨论】:

    标签: ios objective-c textfield padding


    【解决方案1】:

    在你的自定义类中使用这个方法

    - (CGRect)textRectForBounds:(CGRect)bounds {
            return CGRectMake(bounds.origin.x + yourPading, bounds.origin.y + yourPading,
                              bounds.size.width - yourPading, bounds.size.height - yourPading);
        }
        - (CGRect)editingRectForBounds:(CGRect)bounds {
            return [self textRectForBounds:bounds];
        }
    

    【讨论】:

      猜你喜欢
      • 2019-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 2012-07-15
      相关资源
      最近更新 更多