iphone 5 4英寸 [英] iphone 5 4 inch

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

问题描述


可能重复:

如何检测iPhone 5(宽屏设备)?

我正在使用Xcode创建一个应用程序。我注意到使用xcode 4.5,你的故事板可以适应iphone 5的屏幕尺寸。如果我创建两个具有不同屏幕尺寸的独立故事板,但将控制器链接到相同的.h文件,如何根据设备告诉程序加载哪个故事板?

I am creating an app using Xcode. I have noticed that with xcode 4.5, your storyboards can adapt to iphone 5 screen size. If I create two separate storyboards with the different screen sizes, but link the controllers to the same .h file, how can I tell the program which storyboard to load depending on the device?

例如:对于ipad,当我运行时,它会自动选择正确的故事板

eg: for the ipad, when I run, it picks the right storyboard automatically

推荐答案

当前标记的答案没有为我工作所以我创建了下面的方法来检查当前设备是否有4英寸显示器。

The currently marked answer did not work for me so I created the method below to check if the current device has an 4 inch display.

- (BOOL)hasFourInchDisplay {
    return ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568.0);
}

因为这是iPhone上4英寸显示屏的已知高度,所以一个好的指标。

Since that is the known height for the 4 inch display on the iPhone it is a good indicator.

这篇关于iphone 5 4英寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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