Search code examples
iosimageuiviewxamarin.iosuicolor

iOS 'colorWithPatternImage' is adding 1 px borders around my images?


I'm using UIColor's colorWithPatternImage function to set a tiled image on one of my views. The result is a grid of 1 pixel lines all over.

Screenshot showing the problem.

Fig: The clear color grid of lines is the issue.

My intention was to obtain a perfect background using the tiled image.

I first suspected that the image I was using could be faulty, but zooming it to 800% doesn't really show the presence of any transparent one-pixel border anywhere.

Here's the image (@2x version):

Tile-Texture

Any ideas what it could be related to?

Thanks,

p.


Solution

  • you are doing everything fine, but your problem is that your pattern image have 1 pixel line on the top an 1 pixel line on the left side with alpha color so you only need to modify your pattern image simply as that, I have been testing and this is the problem

    I hope this helps you