简体   繁体   English

表格检视储存格大小变更

[英]Table View Cell size changing

I have been having an issue with my TableView in Xcode using Swift. 我在使用Swift的Xcode中使用TableView遇到问题。

I am using Parse, (Sad its shutting down soon) but I think the problem is in the Interface Builder. 我正在使用Parse((很快就将其关闭)),但是我认为问题出在Interface Builder中。 (IB) The issue is that it adds a huge white space below each cell. (IB)问题在于,它在每个单元格下方添加了巨大的空白。

Here's a link to the picture: (I don't have enough reputation to post images straight in the question) 这是图片的链接:(我的信誉不足,无法直接在问题中发布图片)

As you can see in the cell on the IB, there is no space but for some reason it adds this huge space. 如您在IB上的单元中所见,没有空间,但是由于某种原因,它增加了这个巨大的空间。 I have checked the image resolution and size and its the exact size for the UIImageView 我已经检查了图像的分辨率和大小以及它的UIImageView的确切大小

Setup constraints in your UITableViewCell. 在UITableViewCell中设置约束。 Then in viewDidLoad say something like: 然后在viewDidLoad中说类似:

self.tableView.estimatedRowHeight = 120.0 //Or some other approximation of your cell's height

This will cause your table view's cells' height to be determined by the constraints set in the cell. 这将导致表格视图单元格的高度由单元格中设置的约束条件确定。

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

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