简体   繁体   English

UI可以在不同的iPad版本和iPad型号中缩放吗?

[英]UI scaling in different iPad versions and iPad models?

I will launch my App for the first time targeting iPads (universal). 我将首次针对iPad(通用)启动我的应用程序。 My problem is I came across some inequalities in how the UI scales at different iOS-versions and iPad models. 我的问题是,UI在不同的iOS版本和iPad型号上如何缩放时遇到了一些不平等之处。 This is the list of different models form the iPad simulator I tested it against: 这是我针对iPad模拟器进行测试的不同型号的列表:

iPad 2 7.0 iPad 2 7.0

iPad 2 7.1 iPad 2 7.1

iPad 2 8.1 iPad 2 8.1

iPad Air 7.0 iPad Air 7.0

iPad Air 7.1 iPad Air 7.1

iPad Air 8.1 (scales perfectly) iPad Air 8.1(完美缩放)

iPad Retina 7.0 iPad Retina 7.0

iPad Retina 7.1 iPad Retina 7.1

iPad Retina 8.1 (scales perfectly) iPad Retina 8.1(完美缩放)

Some examples and results can be seen in the Pictures below. 一些示例和结果可以在下面的图片中看到。 The inequalities how the tabBar and UISlider scales in different iOS versions and models: tabBar和UISlider在不同的iOS版本和模型中缩放的不平等性:

在此处输入图片说明

My questions are. 我的问题是。

1 .How come my tabBar background picture is so messed up in example iPad 2 iOS 7.0 and not iPad Air 8.1 ? 1.为什么我的tabBar背景图片在示例iPad 2 iOS 7.0中而不是在iPad Air 8.1中如此混乱? (Is it different dimensions I need to consider while using a background picture?) (使用背景图片时是否需要考虑不同的尺寸?)

2 .Can I possibly target different models / versions of iPads and fix my UI like you do with macros for iPhone6 / iPhone6P ? 2。是否可以像针对iPhone6 / iPhone6P的宏一样,针对不同型号/版本的iPad并修复UI? And then how? 然后呢?

3 .How come the interface tabBar background picture scales differently in iPad Air 7.0 and iPad Air 7.1 ?. 3。iPad Air 7.0iPad Air 7.1中 ,界面tabBar背景图片如何缩放? These are the same iPad models with the only inequalities in different iOS versions? 这些是相同的iPad型号,但在不同的iOS版本中唯一不平等吗?

All help is appreciated / Regards 所有帮助表示赞赏/问候

If you are trying to adapt programmatic elements (like image as you mentioned), you can add conditional statements to the relevant UI objects like this: 如果您尝试调整程序化元素(如您提到的图像),则可以将条件语句添加到相关的UI对象,如下所示:

if ([UIDevice currentDevice].model == desiredModel) {

    // Code here (e.g. self.imageView.image = [UIImage imageNamed:@"image"];

} else {

    // Every other case

}

If I need to repeat this process often, I normally set up a BOOL and run a check in viewDidLoad (isPad = YES / NO) and then lay out using that conditional. 如果我需要经常重复此过程,通常可以设置一个BOOL并在viewDidLoad中运行检查(isPad = YES / NO),然后使用该条件进行布局。 Since you are only targeting iPad, you can set up a similar BOOL for whatever devices need certain elements. 由于您只针对iPad,因此可以为需要某些元素的任何设备设置类似的BOOL。

Having said all that, I know very little about how you are setting up your interface (programmatically, storyboard, xibs), so that's all I can offer. 说了这么多,我对您如何设置界面(以编程方式,情节提要,XIB)了解甚少,所以我能提供的就是这些。

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

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