繁体   English   中英

iOS 6:iPhone 5中的背景imageview

[英]ios 6 : background imageview in iPhone 5

在我的iPhone应用程序中,我正在使用背景图片bg.png(用于视网膜尺寸bg@2x.png)。 我将xcode更新为4.5。 现在,我需要安排UI以适合iPhone 5-4英寸显示屏。 由于帧的高度将变为568,因此我需要将背景的高度也固定为568。我在应用中添加了名为bg-568h@2x.png的图像。 但是我没有在xcode中为iPhone 6模拟器获取此图像。 有什么办法得到这张图片吗? 或如何实现?

试试这个动态代码。

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];

如何将bg-568h@2x.png设置为背景图像,并将ImageView缩放比例设置为Aspect Fill?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM