使用故事板构建静态tableview中的重叠单元格 [英] Overlapping cells in static tableview built using storyboard

查看:153
本文介绍了使用故事板构建静态tableview中的重叠单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我正在使用Xcode 6 beta来使用storyboard和swift构建iOS8项目。在故事板中,我在应用程序加载时创建了一个表视图控制器作为我的主视图,并为第一个单元格添加了标签,并为第二个单元格添加了标签。

I'm using the Xcode 6 beta to build an iOS8 project using storyboard and swift. In the storyboard, I've created a Table View Controller as my primary view when the application loads and have added a label to the first cell and a label to the second cell.

该表在故事板中看起来很好,但是当我运行应用程序时,单元格重叠。这是一个全新的项目,没有进行任何其他更改或添加代码。

The table looks fine in the storyboard, but when I run the application, the cells overlap. This is a brand new project with no other changes made or code added.

您可以在下面的照片中看到故事板和正在运行的应用程序。什么可以推动这个?

You can see both the storyboard and the running application in the photo below. Any ideas on what could be driving this?

此外,当我尝试向其中一个单元格添加一个按钮时,我得到一个覆盖90%视图的灰色框。

Additionally, when I try to add a button to one of the cells, I get a grey box that covers 90% of the view.

推荐答案

我想我遇到过这个问题。尝试从标签到单元格的内容视图,从表格视图(及其单元格)到包含视图进行一些自动布局连接,以强制视图的大小合适。

I think I've had this issue. Try making some Auto Layout connections from the label to the Content View of the cell, and from the table view (and its cells) to the containing view, to force the views to be the proper size.

以下对我有用。


  1. 按住Ctrl键并从中拖动标签到它所在单元格的左侧。当模态出现时,选中前导空间到容器框。

  2. 对每一边重复相同的按住Control键并单击并拖动它单元格,在出现时选择相关的自动布局选项。

  3. (可选)尝试按住Control键并从表格视图拖动到包含视图的每一侧(如果有)是一个),并重复上面的步骤。

希望这适合你。

这篇关于使用故事板构建静态tableview中的重叠单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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