简体   繁体   中英

ios - UITableViewCell does not fill the entire width of the table

I think the cells don't fill the parent width because of indicated dimensions 300x300, but I don't know how to change it to parent size.

在此处输入图像描述

在此处输入图像描述

TableView has constraints on the boundaries of the device. I also tried set constraints for the cell but it didn't help.

在此处输入图像描述

You should set constraints in your image and on entire UITableViewCell xib just like in ViewController

This is a very basic design task. You really should take the time to go through a few tutorials on Auto-Layout.

The comment you posted: "Adding constraints in the UITableViewCell xib is not possible for me," along with the image, indicates you are selecting the Content View in your cell xib, but that is not where you want to add constraints.

You need to constrain the elements in your cell to the content view:

在此处输入图像描述

which results in a table view (at run-time) that looks like this:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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