gpt4 book ai didi

ios - 将单元格添加到 UITableView,但它们不会在视觉上显示,但我可以单击并且它们可以工作

转载 作者:行者123 更新时间:2023-11-28 22:15:08 25 4
gpt4 key购买 nike

将 iOS6 应用程序迁移到 iOS7,这在以前是有效的。在 6 上,一切正常。

在 iOS7 上,当向 UITableView 添加单元格时,它们不会在视觉上显示,但当我点击它们应该在的位置时,它们就像它们在那里一样工作。

它就像 UIView 不会重绘自己或其他东西。很奇怪。

有人知道从哪里开始看吗?

========== 更新 =========================

执行递归描述我明白了。

   <UITableView: 0xf3cb000; frame = (0 0; 320 724); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1ac3ef60>; layer = <CALayer: 0x1ac3e480>; contentOffset: {0, 0}>
| <UITableViewWrapperView: 0x1ac3f230; frame = (0 0; 320 724); autoresize = W+H; layer = <CALayer: 0x1ac3f2a0>>
| | <TitDeleteGroupedTableViewCell: 0x1abddfb0; baseClass = UITableViewCell; frame = (0 208; 320 44); autoresize = W; layer = <CALayer: 0x1abddd00>>
| | <TitGroupedTableViewCell: 0x1ac80210; baseClass = UITableViewCell; frame = (0 120; 320 44); autoresize = W; layer = <CALayer: 0x1ac7ff50>>
| | | <UITableViewCellScrollView: 0x1ac803a0; frame = (0 0; 320 44); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1ac800d0>; layer = <CALayer: 0x1ac80570>; contentOffset: {0, 0}>
| | | | <UITableViewCellContentView: 0x1ac80a70; frame = (0 0; 285 44); gestureRecognizers = <NSArray: 0x1ac80bf0>; layer = <CALayer: 0x1ac80ae0>>
| | | | <UIImageView: 0x1abc9b70; frame = (0 42; 320 2); opaque = NO; userInteractionEnabled = NO; tag = 107; layer = <CALayer: 0x1abc9c70>>
| | | | <UITextField: 0x1ac80de0; frame = (10 12; 275 23); text = ''; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x1abc65a0>; layer = <CALayer: 0x1ac80f20>>
| | | | | <UITextFieldLabel: 0x1abc90d0; frame = (0 0; 275 22); text = 'Create plan...'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1abc9170>>
| | | | <UIImageView: 0x1cd992b0; frame = (276 12; 20 21); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1cd99340>>
| | <TitGroupedTableViewCell: 0x1cf999b0; baseClass = UITableViewCell; frame = (0 44; 320 44); autoresize = W; layer = <CALayer: 0x1cf99710>>
| | | <UITableViewCellScrollView: 0x1cf99b40; frame = (0 0; 320 44); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1cf99890>; layer = <CALayer: 0x1cf99d10>; contentOffset: {0, 0}>
| | | | <UITableViewCellContentView: 0x1cf9a1f0; frame = (0 0; 320 44); gestureRecognizers = <NSArray: 0x1cf9a360>; layer = <CALayer: 0x1cf9a260>>
| | | | <UILabel: 0x1cf9a3a0; frame = (10 12; 295 20); text = 'blah'; clipsToBounds = YES; userInteractionEnabled = NO; tag = 105; layer = <CALayer: 0x1cf9a440>>
| | | | <UILabel: 0x1d297390; frame = (10 37; 295 0); text = ''; clipsToBounds = YES; userInteractionEnabled = NO; tag = 106; layer = <CALayer: 0x1d297250>>
| | | | <UIImageView: 0x165836c0; frame = (0 42; 320 2); opaque = NO; userInteractionEnabled = NO; tag = 107; layer = <CALayer: 0x165837d0>>
| | <TitGroupedTableViewCell: 0x1d295080; baseClass = UITableViewCell; frame = (0 0; 320 44); autoresize = W; layer = <CALayer: 0x1d24ee50>>
| | | <UITableViewCellScrollView: 0x1d295210; frame = (0 0; 320 44); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x1d1f3a60>; layer = <CALayer: 0x1c5c4e40>; contentOffset: {0, 0}>
| | | | <UITableViewCellContentView: 0x1d295480; frame = (0 0; 320 44); gestureRecognizers = <NSArray: 0x1d28e4e0>; layer = <CALayer: 0x1d28df50>>
| | | | <UILabel: 0x1d295560; frame = (10 12; 295 20); text = 'Budget-Blah'; clipsToBounds = YES; userInteractionEnabled = NO; tag = 105; layer = <CALayer: 0x1d28e5f0>>
| | | | <UILabel: 0x1caaa710; frame = (10 37; 295 0); text = ''; clipsToBounds = YES; userInteractionEnabled = NO; tag = 106; layer = <CALayer: 0xdbcc210>>
| | | | <UIImageView: 0xd889590; frame = (0 42; 320 2); opaque = NO; userInteractionEnabled = NO; tag = 107; layer = <CALayer: 0xd827d80>>
| | <TitDeleteGroupedTableViewCell: 0x1abce730; baseClass = UITableViewCell; frame = (0 164; 320 44); autoresize = W; layer = <CALayer: 0x1abce6e0>>
| <UIImageView: 0x1ac3ebb0; frame = (0 720; 320 3); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x1ac3ec90>>
| <UIView: 0x1cda3300; frame = (0 88; 320 32); autoresize = W; layer = <CALayer: 0x1cda3360>>
| | <UIImageView: 0x1cda27d0; frame = (0 0; 320 32); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1cda2860>>
| | <UILabel: 0x1cda28f0; frame = (0 0; 320 32); text = 'MY PLANS'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x1cda2990>>
| | <UIButton: 0x1cda33b0; frame = (260 0; 60 32); opaque = NO; layer = <CALayer: 0x1cda34a0>>
| | | <UIButtonLabel: 0x1cda3960; frame = (17 9; 26 14); text = 'EDIT'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1cda3a10>>
| <UIImageView: 0x1ac3ed60; frame = (316 561; 3 7); alpha = 0; opaque = NO; autoresize = LM; userInteractionEnabled = NO; layer = <CALayer: 0x1ac3ee40>>

所以看起来所有的都是可见的,所以这个 PO 是正确的。所以我想发生的事情是当我单击一个空的 tableviewcell(即没有数据)但只有一个没有分隔符的背景图像(即它看起来平坦而光滑)。它仍然让我选择它,好像它是一个好细胞。

所以有两个问题。

  1. 提供给该 TableView 的字典的新数据要么没有数据,要么有但没有重绘。

  2. 它允许我单击空单元格,这是我不希望发生的。

最佳答案

UITableView 的内部结构在 iOS 7 中发生了变化。这在任何地方都没有记录,因为如果您只是使用公共(public) API 没有副作用(将内容添加到 contentView,而不是直接添加到 单元格).

如果您从单元格内部执行类似 self.superview 的操作,则会出现问题,因为 View 层次结构不是由公共(public) API 定义的。

关于ios - 将单元格添加到 UITableView,但它们不会在视觉上显示,但我可以单击并且它们可以工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21898524/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com