简体   繁体   中英

ios having alignment issues of an image in an content view inside a tableview

I have a custom cell inside an UITableView . Within that custom cell I am trying to put an image and to vertically align it horizontally. As soon as I do that I get that red line.
I have clicked the update frames button, there were no pop up of a menu to select any options.

Heres an image to get a better understanding.
What do I need to do to fix it?

我的自定义单元格的图像

The constraints for your image view are not sufficient for Auto Layout to know where & how big the image view should be:
Constraints for views need to specify the position (x, y) plus the size of the view (width, height).

To fix your issue, add constraints for:

  1. leading
  2. trailing, or width
  3. top
  4. bottom, or height

You could also press Add missing constraints in the menu that pops up when you press that |△| button, but I discourage you from doing so, because then it might add constraints you were not actually looking for.

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