簡體   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