问题描述
当我在带有iOS 5.1的Xcode 4.3.1中编译我的应用程序时,我注意到仅在实际设备上背景纹理有一个奇怪的行为.如下面的屏幕快照所示,纹理图块之间存在1px的间距.
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.
我的纹理分别是150x150和300x300(2倍).
My texture are 150x150 and 300x300 at 2x.
到目前为止,我已经在以下相同版本上进行了测试:
So far I've tested the same build on:
- 模拟器iPhone/iPad均为5.0/5.1:没有错误
- 运行5.0.1的iPhone/iPad:没有错误
- 运行5.1:越野车的iPhone/iPad
推荐答案
自5.1以来,我一直遇到相同的问题.我通过对photoshop中的图像执行以下操作来解决它.您可能可以在其他工具中执行相同的操作.
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.
-
加载文件,全选,然后复制到剪贴板
Load the file, select all, and copy to clipboard
在photoshop中创建一个具有相同尺寸,RGB和8位深度,白色背景为72像素/英寸分辨率的新文件.
Create a new file in photoshop that is the same dimension, RGB and 8bit depth with 72pixels/inch resolution with a white background.
将在步骤1中复制的图像粘贴到该图像中
Paste the image you copied in step 1 into this image
保存文件并使用此文件.
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.
这篇关于带有Xcode 4.3.1的iOS 5.1:[UIColor colorWithPatternImage:]仅在设备上具有奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!