iPhone 图像未按实际 PNG 大小加载
我正在使用 cocos2d,但有可能它不是影响它的因素。我正在制作一个像这样的精灵/图像:
if (score.theme == 0) {
menuBg = @"BaseBackground.png";
}
else if (score.theme == 1) {
menuBg = @"BaseBackground-xmas.png";
}
CCSprite *bg = [CCSprite spriteWithFile:menuBg];
bg.position = ccp(160, 240);
[self addChild:bg z:0];
但是,当加载到我的设备上时,圣诞图像似乎比我在项目中使用的实际 PNG 文件小大约 2-3 倍,所有其他图形都很好,没有问题,包括另一个背景图像效果很好。
什么可能导致这种情况发生?在模拟器中加载后,它可以正常工作,但不能在设备上。
I am using cocos2d but there is a chance its not that which is effecting it. I am making a sprite/image like so:
if (score.theme == 0) {
menuBg = @"BaseBackground.png";
}
else if (score.theme == 1) {
menuBg = @"BaseBackground-xmas.png";
}
CCSprite *bg = [CCSprite spriteWithFile:menuBg];
bg.position = ccp(160, 240);
[self addChild:bg z:0];
However, when loaded on my device the xmas image seems to roughly 2-3 times smaller than the actual PNG file I am using in my project, all other graphics are fine, no problem, including the other background image works fine.
What might cause this to happen? Having loaded in the simulator it works fine there, but not on the device.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,资源在设备本身上未正确更新(虽然仅基于观察证据,如果文件名未更改,则资源似乎未可靠更新)。
因此,如果您从设备中删除应用程序并重新部署,这将强制使用新资源。
Sometimes resources aren't correctly updated on the device itself (whilst only based on observational evidence if filenames aren't changed then the resource doesn't seem to be reliably updated).
As such, if you remove the application from the device and re-deploy this will force the new resources to be used.