• Default.png(圖片尺寸為320x480):顯示在非Retina-3.5英寸屏幕上(iPhone3G\iPhone3GS,屏幕分辨率為320x480)
• Default@2x.png(圖片尺寸為640x960):顯示在Retina-3.5英寸屏幕上(iPhone4\iPhone4s,屏幕分辨為640x960)
• Default-568h@2x.png(圖片尺寸為640x1136):顯示在Retina-4.0英寸屏幕上(iPhone5,屏幕分辨率為640x1136)
一、高度適配
iPhone5的尺寸是640x1136,iPhone4的尺寸是640x960,多出來的176px如何處理?
那么原先iPhone4的app程序都要如何去適配新的iPhone5界面呢??
答:以前不考慮iphone5的時候,我們寫一個頁面最下方的UIButton。會這么寫:
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 460-44, 320, 44)];
現在考慮iphone5的長屏幕,就需要這么寫:
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-44, 320, 44)];
以前固定的高度,現在需要自動獲取了。