简体   繁体   中英

ios 6 : background imageview in iPhone 5

In my iphone application I am using a background image bg.png (for retina size bg@2x.png). I updated xcode to 4.5. Now I need to arrange the UI for fit into iPhone 5 - 4 inch display. Since the frame height will become 568, I need to fix my background also having a height 568. I added a image named bg-568h@2x.png in my app. But Iam not getting this image for iPhone 6 simulator in xcode. Is there any way to get this image? or how can I achieve this?

Try this dynamic code....

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

or

This creates a memory leak. Either change initWithPatternImage to colorWithPatternImage, or assign your UIColor object to a variable and properly release it:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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