我想在iPhone應用程序中顯示圖像,但我使用的圖像太大。 我想調整它以適應iPhone屏幕,我找不到任何類來處理它。如何在iPhone UIImage或UIImageView中擴展圖像尺寸
8
A
回答
20
UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"your_image.png"]];
view.frame = CGRectMake(0, 0, width, height);
要拿到iPhone屏幕的框架,你可以使用
CGRect frame = [[UIScreen mainScreen] bounds];
0
我的ImageView在IB設置,並且我需要顯示多個圖像,所以設置ImageView的形象,而不是爲個人圖像創建ImageView。
當我設置圖像視圖的幀大小後,我仍然看到相同的結果,圖像太大,以至於只有部分圖像顯示在屏幕上。
17
在Interface Builder中,選擇你的UIImageView。從工具菜單中選擇「屬性檢查器」。在圖像視圖屬性面板中,從模式彈出菜單中選擇「Scale to Fill」。這應該縮放你的形象以適應。
相關問題
- 1. iPhone編程:如何在實際尺寸的UIImageView中製作UIImage?
- 2. iphone 4S - 的UIImage CGImage圖像尺寸
- 3. 在UITableViewCell上設置UIImage尺寸圖像
- 4. 避免在我的UIImageView中擴展UIImage
- 5. 如何在UIImageView中加載並顯示小尺寸圖像後加載大尺寸圖像?
- 6. UIImage&UITableViewCell尺寸
- 7. UIImageView如何根據UIImage的尺寸自動調整大小
- 8. 的UIImageView或UIImage的類動畫圖像?
- 9. 如何改變面板尺寸在像Chrome擴展
- 10. iPhone 5,iPhone 6圖像尺寸
- 11. iPhone:如何擴展可重複的UIImage?
- 12. 尺寸圖像的尺寸1600 * 1200
- 13. iPhone:不同尺寸的面膜UIImageView到平方尺寸
- 14. iPhone:下載圖像然後顯示在UIImageView與@ 2x擴展
- 15. 在UIImageView中設置圖像與原始尺寸在ios
- 16. 如何使用UIImageView顯示大尺寸圖像
- 17. 圖像尺寸,
- 18. iPhone圖片尺寸
- 19. 如何旋轉UIImage或UIImageView?
- 20. 圖像尺寸
- 21. 分享擴展未上傳全尺寸圖像
- 22. Iphone SDK:比較圖像尺寸
- 23. iPhone:以原始尺寸顯示圖像
- 24. iOS的圖像尺寸爲iPhone和iPad
- 25. 調整圖像尺寸iPhone SDK
- 26. Iphone 5 - 6plus圖像尺寸/分辨率?
- 27. iPhone 6/6 +圖像尺寸 - Xcode的6
- 28. 的UIImage和NSImage中報告不同的圖像尺寸
- 29. IPhone UIImageView圖像
- 30. ImageView圖像尺寸
如何使用代碼進行編程以實現「Scale to Fill」效果? – Forrest 2011-02-01 06:58:05