iPhone-5兼容问题 [英] iPhone-5 compatible issue

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

问题描述

我已经为ios 4.0开发了一个ios应用程序.这是基于导航的应用程序.现在我希望它也支持iPhone-5.我想我在检查设备版本后更改了xib,我面临的问题是xib已更改但视图高度不变.如果其他人遇到这个问题怎么可能,请与我分享想法.谢谢.

I had developed an ios app for ios 4.0.That was navigation based application.Now I want it also support for iPhone-5 I think I changed xib after checking device version,I am facing problem xib is changed but it's view Height is not changed.How it can possible if some else face this problem please share ideas with me.Thanks.

推荐答案

将iOS 6设置为基本SDK,并使用自动布局"功能制作可缩放为所有类型屏幕的屏幕.您需要Xcode 4.5才能做到这一点.

Set iOS 6 as the Base SDK and use the Auto Layout feature to make screens that can scale for all type of screens. You'll need Xcode 4.5 to do this.

在这里开始使用自动版式:
http://www.raywenderlich.com/20881/beginning -auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning -auto-layout-part-2-of-2

Get started with Auto Layout here:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2

如果您仍要支持iOS 4.0,请为不同的屏幕尺寸使用单独的.xib文件,并在启动时适当地加载它们.

If you still want to support iOS 4.0, have separate .xib files for different screen sizes and load them appropriately at launch.

要根据屏幕大小加载不同的笔尖文件,请在您的应用程序委托中添加/替换以下代码-(BOOL)应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

To load different nib files based on your screen size, in your app delegate, you will need to add/replace the following code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_4inch" bundle:nil];
} else {
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
}

其中ViewController_4inch是为iPhone 5屏幕设计的nib文件的名称

where ViewController_4inch is the name of the nib file that is designed for iPhone 5 screen

这篇关于iPhone-5兼容问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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