按钮和标签不在位 [英] Buttons and Labels Not in Place

查看:31
本文介绍了按钮和标签不在位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问的可能是最简单的问题之一,哈哈,但就是想不通.

I am asking perhaps one of the easiest questions lol but just could not figure it out.

我根据 iPhone 7 的屏幕尺寸创建了一些视图控制器,但是当我将设备更改为 iPhone 7plus 和 iPhoneSE 时,我的标签和按钮都错位了...

I have some view controllers created based on the screen size of iPhone 7, but when I change devices to iPhone 7plus and iPhoneSE, my labels and buttons were all misplaced...

我已经上传了它们在不同设备上的样子,有人可以帮忙吗?

I have uploaded what they look like in different devices, can somebody please help?

WhatItLooksLikeOniPhone7

WhatItLooksLikeOniPhoneSE

推荐答案

要将 UI 元素保持在定义的位置,您需要一些将元素保持在其位置的东西.因此你需要使用自动布局.Autolayout 基本上是一个基于约束的系统,它将布局 ui 元素.有很多可用的教程.

To keep the UI elements at a defined place you need to something that will keep the elements at their position. And hence you need to use autolayout. Autolayout is basically a constraint based system which will layout the ui elements. There are many tutorials available.

这篇关于按钮和标签不在位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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