将iOS6应用程序迁移到iOS7以前曾经使用过。一切都运行正常。
在iOS7上向UITableView添加单元格时,它们不会在视觉上显示,但是当我点击它们应该在哪里时,它们就像在那里一样工作。
就像UIView不会重绘自己或其他东西。很奇怪。
任何人有什么想法甚至可以开始看?
========== 更新 =========================
执行recursiveDescription我得到了这个。
<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(即没有数据)但只有一个没有分隔符的背景图像(即它看起来平坦而平滑)。它仍然让我选择它好像它是一个好的细胞。
所以有两个问题。
为此tableview提供的字典中的新数据要么没有数据,要么没有重绘。
它允许我点击空单元格,我不想发生这种情况。
答案 0 :(得分:2)
UITableView的内部结构在iOS 7中已更改。这在任何地方均未记录,因为如果您只使用公共API,则无任何副作用(将内容添加到contentView
,而不是直接添加到cell
)。
如果您从单元格内部执行self.superview
之类的操作,则会出现问题,因为公共API未定义视图层次结构。
答案 1 :(得分:0)
尝试在didSelectRowAtIndexPath
之类的地方放置一个断点,然后输入po [self.tableView recursiveDescription]
来查看您的视图层次结构。看起来您的单元格要么为空,要么布局都是内容在屏幕外。然后报告回来,请为您的问题添加更多详细信息,例如代码和屏幕截图(它应该与您获得的内容相似)等。