Chris
Chris

Reputation: 27384

colorWithPatternImage creates black lines across view

Since updating to the latest XCode (although it may be iOS 5.1 related) I have noticed my iPhone now shows black horizontal lines between repetitions of my background image. This does not show on the simulator (normal or retina). Note my iPhone is retina.

I have tried adding a retina version of the background image but this shows the same issue (except the horizontal lines are twice as close to each other due to the resolution change). Another interesting thing is that the lines are only horizontal despite the background image being square, not sure how relevant this is?

Here is the code

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"light_alu.png"]];

I also tried the code listed in this similar question to no avail.

Here is a screenshot of my game with the horizontal black lines (notice there is one right at the very top beneath the toolbar)enter image description here

What is causing this to happen?

Upvotes: 1

Views: 1229

Answers (1)

Chris
Chris

Reputation: 27384

I solved the issue using the answer here. Essentially optimised PNGs cause the issue and re-saving the image without any fancy compression will fix it.

Upvotes: 2

Related Questions