简体   繁体   English

如何为所有iPhone安装视图控制器?

[英]How to fit view controller for all iPhones?

I'm working on some apps and I am seriously sad about setting the viewcontroller. 我正在开发某些应用程序,但对设置ViewController感到非常难过。 Whenever I try my app on different iPhones it looks so fitful. 每当我在不同的iPhone上尝试我的应用程序时,它看起来都非常合适。 I just want to see my app automatically resized on all iPhones. 我只是想看看我的应用在所有iPhone上自动调整大小。

I made an example app to explain better. 我制作了一个示例应用程序以更好地解释。

This is the iPhone 5 screen 这是iPhone 5屏幕

iphone 5

and this is the iPhone 6S screen 这是iPhone 6S屏幕 iPhone 6S

You definitely need to use Autolayout. 您肯定需要使用自动版式。 This is the main tool used to dev UI through all iDevices. 这是用于通过所有iDevice开发UI的主要工具。 Here is a good start : 这是一个好的开始:

https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2

You will also need to use size class which use auto layout but allow you to custom your constraints depending on the idevice : 您还需要使用使用自动布局的size类,但允许您根据idevice定制约束:

https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started https://www.raywenderlich.com/113768/adaptive-layout-tutorial-in-ios-9-getting-started

That's a lot to learn, but believe me, you'll have to use that :) 有很多东西要学习,但是请相信我,您将必须使用它:)

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

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