简体   繁体   English

iOS UITableView右半截屏

[英]IOS UITableView right half cut off screen

For some reason, no matter what I do, when I create a static tableview inside a UITableViewController, put content into the cells and run the simulator the right half of the screen is always cut off and I don't know why. 出于某种原因,无论我做什么,当我在UITableViewController内创建静态tableview时,将内容放入单元格中并运行模拟器时,屏幕的右半部分总是被切断,我不知道为什么。 Ive tried making new projects and remaking the storyboard but nothings working. Ive尝试制作新项目并重新制作情节提要,但无济于事。

Here's what it looks like when I run the app 这是我运行该应用程序时的样子

在此处输入图片说明

heres what the storyboard looks like. 这是情节提要的样子。 在此处输入图片说明

I have content set to static cells 我已将内容设置为静态单元格

Anyone run into this problem or know how to fix it via storyboard (or programmatically but not preferred)? 任何人都遇到这个问题,或者知道如何通过情节提要(或以编程方式,但不是首选方式)解决该问题?

Update: 更新:

Here are some more pictures of what another project looks like when I run it: 这是运行我的另一个项目时的更多图片:

在此处输入图片说明

and here's what the storyboard looks like 这就是情节提要的样子

在此处输入图片说明

You need to give constraints to your right button... 您需要对右键进行限制...

For that select your button and pin its edges to right, top, bottom and give width constraint like below 为此,选择您的按钮并将其边缘固定到right, top, bottom and give width限制,如下所示

在此处输入图片说明

and here is autolayout tutorial link .. you can check that 这是自动布局教程链接 ..您可以检查一下

I see the problem in giving constraints to the table not for the button. 我看到了为表而不是按钮提供约束的问题。 Try giving constraints to the table like "leading space to superview,trailing space to superview,top space and bottom space to superview 尝试对表施加约束,例如“前导空间领导,后视空间领导,顶部空间和底部空间管理”

Edit: The above solution given by me might fix for tableview inside UIViewcontroller. 编辑:我给的上述解决方案可能会修复UIViewcontroller中的tableview。

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

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