1

我正在尝试将背景图像放入文本字​​段(它只是一个搜索图标)。它在文本字段中平铺图像。是否可以关闭图像的重复?我没有看到类似的东西,我看到背景图像的填充和位置,但没有任何东西可以关闭图像的平铺。这在pixate中还不可能吗?

谢谢!

4

2 回答 2

2

您应该能够将背景大小设置为文本字段的大小,这样它就不会重复任何内容。

于 2014-01-16T21:08:12.730 回答
1

I battled this same problem, and in the end, I found I got what I wanted by using multiple objects. Even if you get the search icon to work right, you're probably going to notice the UITextField doesn't pad the text away from the icon.

Anyway, here's how I ended up doing it so that I had full control over the style.

enter image description here

So you can put your search icon in the UIImageView and then define your text field's style (border, background color, etc.) with the UIView. The UITextField ends up being plain white/transparent, and positioned so that its text doesn't overrun the search icon.

I hope that helps.

于 2014-01-17T05:32:40.293 回答