简体   繁体   English

iPhone4 UI设计与iPhone5相比

[英]iPhone4 UI design vs iPhone5

I have a next problem. 我有下一个问题。 I was searching in Google and here but still not found correct and proper solution. 我在谷歌和这里搜索,但仍未找到正确和正确的解决方案。 I have application which has to run on iPhone 4 and on iPhone 5. As we know iPhone 5 has a different screen size then 4th one. 我的应用程序必须在iPhone 4和iPhone 5上运行。我们知道iPhone 5有不同的屏幕尺寸,然后是第4个。 Let's see simple case, I have a view controller with background image. 让我们看一下简单的情况,我有一个带背景图像的视图控制器。 Image is size sensitive and if I will stretch it it will look ugly. 图像尺寸敏感,如果我拉伸它会看起来很难看。 So I have two different images one image for old 4th resolution and and another image for new 5th one. 所以我有两个不同的图像,一个图像用于旧的第四个分辨率,另一个图像用于新的第五个分辨率 The question is what is the best and let's say "native" way to implement correct image showing on the both devices. 问题是什么是最好的,让我们说“本地”的方式来实现在两个设备上显示正确的图像。

I see simplest way to do it is making runtime checking which device currently used and set proper image name to UIImageView. 我认为最简单的方法是运行时检查当前使用的设备,并将正确的图像名称设置为UIImageView。 But I find it ugly. 但我发现它很难看。 Does somebody know the correct way to do it? 有人知道这样做的正确方法吗?

You can use: 您可以使用:

#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)

Then, 然后,

if (IS_IPHONE5) {
//iPhone5
} else {
/older devices
}

Source: How to get the actual [UIScreen mainScreen] frame size? 来源: 如何获得实际的[UIScreen主屏幕]框架大小?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM