约束在TableViewCell中不起作用 [英] Constraints not working in TableViewCell

查看:86
本文介绍了约束在TableViewCell中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习如何使用CoreData存储图像,并且正在制作博客阅读器。我有一个视图,该视图显示所有保存为列表的信息,单击时将带您到该文章。我的问题是我无法使TableViewCells看起来像预期的那样。我添加了约束,但没有一个被放置。

I'm learning how to use CoreData to store images, and I'm making a blog reader. I have a view That shows all the info saved as a list and when you click it takes you to that article. My problem is that I can't make TableViewCells look as intended. I have added the constraints and not a single of them is being placed.

这是我的限制:

Here are my constraints:

结果就是:

And this is the result:

我已经删除了它们,清理了一下,关闭了xCode,放了进去他们再次和相同的结果。找到了此答案,未进行任何检查。另外这一个。在同一个项目中,我有另一个TableView,它工作正常,有什么想法为什么会发生这种情况?非常感谢!

I've deleted them, cleaned, closed xCode, put them again and the same result. Found this answer, checked and nothing. Also this one. In the same project, I have another TableView and it works fine, any ideas why this is happening? Thanks a lot!

推荐答案

看起来图像从容器中溢出了。试试这个

Looks like image is overflowing form the container. Try this


  1. 将UIImageView内容模式设置为 UIViewContentModeScaleAspectFill

  2. 将UIImageView clipToBounds 设置为true。

  1. Set the UIImageView content mode to UIViewContentModeScaleAspectFill
  2. Set UIImageView clipToBounds to true.

这篇关于约束在TableViewCell中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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