2015-06-12 91 views
0

我正在開發中,我正在顯示某張圖片,如刪除圖標的應用程序,搜索icon.I有圖像的名字是如何使用故事板將圖像縮放到不同的iPhone屏幕?

  • delete.png
  • [email protected]
  • 刪除@ 3x.png

    我已經創建images.xcassets &添加的圖像爲1x,2x & 3x。現在我在故事板上添加了一個UIImageView &它的默認圖像是delete.png(32*32)它在3.5英寸的屏幕上運行良好,但圖像不能縮放4.7 & 5.5英寸屏幕iPhone。可以有人請幫我。&怎麼辦?

+1

而不是使用與'delete.png'的'delete' – Bannings

+0

都是2倍和3倍的圖像具有相同比率1倍???並檢查imageView屬性是否設置了scaleToFit –

+0

您的圖片視圖是否正確調整大小? –

回答

1

我厚@Banning和@Fatti Khan的建議將是問題的解決方案。 代替使用圖像的名稱作爲delete.png使用只刪除 作爲比設定用圖像的確切大小如實施例如果1x圖像是30 PX然後2×必須是60像素和3×90像素

1x images are for the original iPhone through the 3GS - 'standard' resolution devices (3.5" screens) 

2x images are for the iPhone 4, 4S (3.5" Retina screens) and also iPhone 6. 

Retina 4 2x are for the iPhone 5 and 5s (4" Retina screens) 

3x images are for the new iPhone 6+ (5.5" super-Retina [3x] screen) 

enter image description here

編輯: 請清理您的項目,然後再次檢查(cmd + shift + k)刪除您的派生數據。 還檢查您的視圖是否自動佈局啓用或禁用。

添加的啓動圖像[email protected]因爲我認爲你的代碼無法檢測到不同類型的屏幕也有,所以按照這個步驟

  1. 首先,我想表明,
  2. Preapre所有圖像,
  3. 選擇從項目導航項目,並轉到總結和向下滾動此 屏幕出現,然後用鼠標右鍵單擊該從你選擇文件210電腦它會自動複製到項目,它會進入 plist文件也
  4. 如果您的應用程序是通用的,那麼你有 設置爲iPhone和iPad兩者。 enter image description here
+0

我已經使用image.xcasstes再次閱讀我的問題。 – Techiee

+0

請檢查編輯答案並試用它,它工作嗎? – iphonemaclover

+0

我正在使用xcode 6.我沒有任何摘要選項。我已經將所有圖像複製到xcode中的一個組,然後將圖像拖放到images.xcassets。 – Techiee

相關問題