表格视图的起始位置在模拟器中是错误的,在故事板中是不一样的 [英] start position of table view is wrong in simulator, and is not the same in storyboard

查看:110
本文介绍了表格视图的起始位置在模拟器中是错误的,在故事板中是不一样的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在故事板中创建了一个tableview,看起来不错,但是模拟器或设备中的起始位置是错误的。 标签不应与时间位于同一位置。我该怎么解决?

I created a tableview in storyboard, which looks good, but the start position is wrong in the simulator or device. The 'Label' should not be at the same position as the time. How could I solve it??

推荐答案

模拟指标就是这样。模拟。它们可用于设置视图实际显示的方式,以帮助在故事板中设置外观,但是实际程序中是否显示导航栏或Tabbar与您是否选择它无关作为故事板上的模拟指标。

Simulated metrics are just that. Simulated. They're useful to set to how the view will actually display in order to help set up the look in the storyboard, but whether or not a navbar or tabbar shows up in the actual program is irrelevant to whether or not you've selected it as a simulated metric on the storyboard.

在这种情况下,您可能正在使用约束,并将标签的y原点设置为容器视图下方0像素。当您使用模拟的故事板指标时,这会将标签放在您在故事板上模拟的导航栏下方。但是在您的实际项目中,您没有在此场景中包含导航栏,并且您的标签出现在视图控制器的顶部。

In this case, you're probably using constraints, and setting the label's y origin to be 0 pixels below the container view. When you use the simulated storyboard metrics, this puts the label just below the navbar that you're simulating on the storyboard. But in your actual project, you've done nothing to include a navbar on this scene, and your label is appearing at the top of the view controller.

您可以学习如何防止状态栏显示......或者你可以将标签的y原点移动到20像素(状态栏的高度)。

You can either learn how to prevent the status bar from displaying... or you can move the label's y origin to being a 20 pixels down (the height of the status bar).

如果您提供有关如何进行布局(自动布局?)的详细信息,以及您希望它的外观,我可以提供更多帮助。但我首先要将所有模拟指标保留在推断上,并且只有在编写代码以编程方式添加/删除其中一个后,才会明确更改模拟指标。您可以通过模拟指标进行更改的功能。

I can provide more help if you provide more details on how you're doing your layout (autolayout?), and exactly how you want it to look. But I'd start by leaving ALL of the simulated metrics on inferred and only ever explicitly change a simulated metric after you've written the code to programmatically add/remove one of the features you can change via the simulated metrics.

如果您不接受此答案,请理解这样:从模拟指标下拉菜单中选择项目只会更改视图在故事板中的显示方式,并且不会更改应用中实际显示的内容。

这篇关于表格视图的起始位置在模拟器中是错误的,在故事板中是不一样的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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