29

When I compile my app in Xcode 4.3.1 with iOS 5.1, I notice there is a strange behavior with background textures only on actual device. There is a 1px gap in between texture tiles shown in screenshot below.

My texture are 150x150 and 300x300 at 2x.

So far I've tested the same build on:

  • Simulator iPhone/iPad both 5.0/5.1: No bug
  • iPhone/iPad running 5.0.1: No bug
  • iPhone/iPad running 5.1: Buggy

Compare side by side screenshots

Kent Nguyen
  • 3,042
  • 2
  • 20
  • 15

3 Answers3

14

I've been getting the same problem since 5.1 aswell. I solved it by doing the following to the image in photoshop. You can probably do the same in another tool.

  1. Load the file, select all, and copy to clipboard

  2. Create a new file in photoshop that is the same dimension, RGB and 8bit depth with 72pixels/inch resolution with a white background.

  3. Paste the image you copied in step 1 into this image

  4. Save the file and use this one.

After doing this the file displayed correctly on the device and I didn't have to resort to creating images the size of the display.

BinaryGuy
  • 1,246
  • 1
  • 15
  • 29
  • So you don't optimise PNGs after this? Simply 'save' with Photoshop will create a min 49kb file size and I don't want that. – Kent Nguyen Mar 15 '12 at 04:38
  • 2
    This ***also*** worked for me: Using Pixelmator I exported the image as PNG and that is all :) – nacho4d Mar 15 '12 at 09:56
  • 1
    Confirm the fix by Pixelmator. Saving without any special option will do. Optimizing that saved image will again lead to the problem. – Kent Nguyen Mar 16 '12 at 10:16
  • Thankyou, this is surely a bug but at least I have fixed it now ! – Chris Mar 18 '12 at 00:14
  • 2
    I'm encountering this in 5.1 as well and filed rdar://11069678 . It appears to be the last line of pixels in *any* PNG8 or grayscale PNG file (basically, any PNG file that can't be premultiplied optimized by Apple's pngcrush tool) – iccir Mar 18 '12 at 23:38
  • My solution was to keep the PNG files as PNG8s, add an additional few lines of padding, and then crop it off in code. – iccir Mar 18 '12 at 23:39
9

My workaround: Set "Compress PNG Files" to "No" in Build Settings. In my case the size of the app bundle was even smaller than with compression turned on. I did image optimization myself.

Fabian
  • 91
  • 1
5

just in case anyone else is having this problem and uses pngoptimizer, try a new png without optimizing it.

I had the same problem and spent the last 4 hours trying to solve it. In the end i realized it was png file from the pngoptimizer tool that somehow always worked before iOS 5.1 but with the update the same png file produces this thin line at the bottom. the strange thing is that this does only happen on the device and not in simulator and that deceives you a lot because you think it cant be the graphic. in fact it is.

Etienne678
  • 444
  • 4
  • 12