屏幕高度兼容iphone5和iphone4 [英] Screen height compatible in iphone5 and iphone4

查看:120
本文介绍了屏幕高度兼容iphone5和iphone4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何支持更高的iPhone 5屏幕尺寸?

我是iPhone新手,我有一点疑问。现在iphone5屏幕高度为568,之前的iphone屏幕高度为480.我们如何为iphone5实现应用程序。我们应该一直检查iphone5及以下版本的视图或控制器吗?如果错了请纠正我。

I am new to iPhone and I have a small doubt. Now the iphone5 screen height is 568 and previous iphone's screen height was 480. How can we implement apps for iphone5.Should we check views or controllers all the time for iphone5 and below versions? If am wrong Please correct me.

提前致谢。

推荐答案

这里是积分
*如果你想利用iPhone5的全高度创建大小为640x1136像素的闪屏,名称default-568h@2x.png
*如果你有旋转检查问题
a) window.rootViewController = firstViewcontroller(不要向窗口添加视图)
b)实现新的rorate委托函数

here are the points *if you want to make use of full height of the iPhone5 create splash screen that's exactly 640x1136 pixels in size and name default-568h@2x.png *if you have problem with rotation check a)window.rootViewController = firstViewcontroller (dont add view to your window) b)implement the new rorate delegate function

*使用viewDidLayoutSubviews而不是viewDidLoad来设置窗口小部件大小相对于窗口
*您可以手动检查屏幕大小并加载正确的图像,如下所示:

*Use viewDidLayoutSubviews rather than viewDidLoad to set up widget sizes relative to the window *You can manually check the screen size and load the right image like this:

    UIImage* myImage;
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
if ([UIScreen mainScreen].scale == 2.f && screenHeight == 568.0f) {
   myImage = [UIImage imageNamed:@"myImage-568h@2x.png"];
} else {
} 



myImage = [UIImage imageNamed:@"myImage.png"];

或使用来自以下GIT要点的catogary
https://gist.github.com/3719620

or use catogary from the following GIT gist https://gist.github.com/3719620

这篇关于屏幕高度兼容iphone5和iphone4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆