iOS: Items in custom UITableViewCell not showing u

2019-09-10 05:30发布

问题:

I have encountered one peculiar situation where items I included (UILabels, UIButtons, etc) in my UITableViewCell does not show up in a consistent way, i.e.: If I try add-in new items, they do not show up although I've made sure that proper connections have been made.

I even tried deleting the prototype cell and re-do the prototype cell from scratch. Now, it's even more weird, nothing is showing up when I run the app in both my simulator and device.

A few possibilities I think could have contributed to the problem:

  1. There's a bug in xCode 6.1 and xCode 6.1.1
  2. There's a bug in Storyboard
  3. The items's frame (x,y,height,width) are somehow screwed up during runtime. I use autolayout.
  4. The storyboard or my project's config stuff are messed up somehow.

I have totally no idea on how to fix it. Any wise hard-core coder out there able to help? My source code folder is here for your reference: http://dropbox.com/sh/v1prxriqd7pcsws/AABbjYCPwlTMfzgY4Y2xh-PJa?dl=0

*Note: The TableViewController involved is "NewsFeedPageTableViewController", Cell class involved is "NewsFeedCell", and in the file, the specific problem you may find is the coverImage item which is currently not showing when the app runs. Try add in new items, and be surprised that they won't show up either. Try re-do the cell and be surprised still!

Need Help!

回答1:

The UIImageView in the cell is uninstalled fro size classAny Any, but is installed for size class reg reg - so it will only appear on iPad devices.

The image view is also missing constraints, so there are layout errors. When I installed it for Any Any and added constraints it appeared