简体   繁体   English

iOS:自定义UITableViewCell中的项目显示不一致。 故事板错误?

[英]iOS: Items in custom UITableViewCell not showing up consistently. Storyboard bug?

I have encountered one peculiar situation where items I included (UILabels, UIButtons, etc) in my UITableViewCell does not show up in a consistent way, ie: If I try add-in new items, they do not show up although I've made sure that proper connections have been made. 我遇到了一种特殊情况,即我在UITableViewCell中包含的项(UILabel,UIButton等)无法以一致的方式显示,即:如果我尝试添加新项,尽管已经完成,但它们不会显示确保已建立正确的连接。

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 xCode 6.1和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. 物品的框架(x,y,高度,宽度)在运行时以某种方式被弄乱了。 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 我的源代码文件夹在这里供您参考: 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. *注意:涉及的TableViewController是“ NewsFeedPageTableViewController”,涉及的Cell类是“ NewsFeedCell”,在文件中,您可能会发现的特定问题是coverImage项,该项在应用程序运行时当前未显示。 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! 需要帮忙!

The UIImageView in the cell is uninstalled fro size class Any Any , but is installed for size class reg reg - so it will only appear on iPad devices. 单元格中的UIImageView已从大小类Any Any卸载,但安装了大小类reg reg因此它将仅出现在iPad设备上。

The image view is also missing constraints, so there are layout errors. 图像视图也缺少约束,因此存在布局错误。 When I installed it for Any Any and added constraints it appeared 当我为Any Any安装它并添加约束时,它出现了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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