Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

iphone - iOS 5.1 with Xcode 4.3.1: [UIColor colorWithPatternImage:] strange behavior only on device

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...