2

在我的 iphone 应用程序中,我使用的是背景图像 bg.png(对于视网膜大小 bg@2x.png)。我将 xcode 更新为 4.5。现在我需要安排 UI 以适应 iPhone 5 - 4 英寸的显示屏。由于框架高度将变为 568,我需要修复我的背景高度也为 568。我在我的应用程序中添加了一个名为 bg-568h@2x.png 的图像。但我没有在 xcode 中为 iPhone 6 模拟器获取此图像。有没有办法得到这个图像?或者我怎样才能做到这一点?

4

2 回答 2

1

试试这个动态代码....

self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg.png"]];

或者

这会造成内存泄漏。要么将 initWithPatternImage 更改为 colorWithPatternImage,要么将你的 UIColor 对象分配给一个变量并正确释放它:

UIColor *color = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg.png"]];
self.view.backgroundColor = color;
[color release];
于 2012-10-08T09:58:50.053 回答
0

将 bg-568h@2x.png 设置为背景图像,并将 ImageView 缩放设置为 Aspect Fill 怎么样?

于 2012-10-08T10:15:02.440 回答