IOS适配


• 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)];
以前固定的高度,现在需要自动获取了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM