因此,我製作的應用程序有很多圖像,我用於UI,但我遇到了@ 1x,2x和現在我正在嘗試設置幀的3倍概念。使用新的@ 3x幀適當地構圖圖像
所以第一關,我寫了含有一種叫getDevice
這樣我就可以判斷用戶正在使用設置正確的框架爲每個元素是什麼設備功能的全局函數庫:
//Device
+ (int)getDevice
{
CGSize bounds = [[UIScreen mainScreen] bounds].size;
if((bounds.width == 320 && bounds.height == 480) || (bounds.width == 480 && bounds.height == 320))
return gDevice_iPhone4S;
else if((bounds.width == 320 && bounds.height == 568) || (bounds.width == 568 && bounds.height == 320))
return gDevice_iPhone5;
else if((bounds.width == 375 && bounds.height == 667) || (bounds.width == 667 && bounds.height == 375))
return gDevice_iPhone6;
else if((bounds.width == 414 && bounds.height == 736) || (bounds.width == 736 && bounds.height == 414))
return gDevice_iPhone6Plus;
else if((bounds.width == 768 && bounds.height == 1024) || (bounds.width == 1024 && bounds.height == 768))
return gDevice_iPad;
return gDevice_Unknown;
}
這一切運作良好,但是我的問題圍繞着框架大小,現在我可以識別出正確的設備。所以,舉個例子,假設我有三個按鈕,我想跨越屏幕的底部。在iPhone 4S上,這將是這樣的:
現在,這是使用3張圖片:
- [email protected](220x80)
- [email protected]( 200x80)
- [email protected](220x80)
但是,當我想上的IP使用這些照片,會發生什麼磨練6?
現在這個應該使用相同圖片,沒錯,自從iPhone 6仍然使用@ 2倍?
- [email protected](220x80) - >(258x94)
但隨後(220x80)
需要成爲(258x94)
這將拉伸圖像。那麼,當我需要@ 1x,@ 2x,@ iPhone62x和@ iPhone6Plus3x時,擁有@ 1x,@ 2x和@ 3x iPhone圖像有什麼意義?