TableViewCell with Autolayout constraint issue

淺唱寂寞╮ 提交于 2019-12-14 02:43:49

问题


I've been trying for 2 days in a row to fix a custom cell I created. I'm new to iOS, so I've been reading that I must set constraint if use autolayout is enabled.

Even though I set some constraints, the issue is still there, so I'm guessing either ways the iOS Simulator has a bug I'm not aware of, or there was something missing in the 10+ guides & tutorials I have already read. Yes, I made my research, I've read several articles including:

  • Using Auto Layout in UITableView for dynamic cell layouts & variable row heights (this one seems to be the more complete one)

The custom cell is being created in the storyboard, here's a picture containing the contraints:

(The UIImageView's view mode is set to center)

And here's a picture of the iOS Simulator:

EDIT: I also deleted all constraints, but the result is the same, the iOS Simulator renders it the same way

SOLUTION: This is so stupid, my UIImageView pointer was called *imageView and it seems UITableViewCell has a pointer with the same name so whenever I called it, mine was being ignored, and instead was called the superclass' one, resulting not in what I thought it was a resize issue, but a superposition


回答1:


Hey Man this is just a quick thought. I would post it in comments but I don't have a high enough rep on here. Have you tried selecting the UIImageView, opening up the inspector tab, and check if the UIImageView is set to "Clip Subviews"?



来源:https://stackoverflow.com/questions/25210810/tableviewcell-with-autolayout-constraint-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!