如何在 UITextField 中的图像和文本之间缩进 space

how to indent a space between image and text in UITextField

我正在尝试在用户要键入的文本和文本字段中的 UIImage 之间添加 space。谁能帮帮我。

如果你谈论 leftView and rightView, you can create subclass of UITextField and override follow methods:

- (CGRect)leftViewRectForBounds:(CGRect)bounds;
- (CGRect)rightViewRectForBounds:(CGRect)bounds;