See the headline, you might think, how can someone fool to do this? Well, a programmer like me who has no experience is really possible. The background to this problem is that when you need to redraw UITableViewCell , you often encounter situations where you need to clear all subview. And we have a piece of code that can take advantage of:
Uiview+utils.m
-(void) Removeallsubviews {
For (UIView *subview in self.subviews) {
[SubView Removefromsuperview];
}
}
The right approach
The right thing to do is to add all the sub-view to the Contentview .
sometableviewcell.m
[Self.contentview Removeallsubviews];
......
[Self.contentview Addsubview:view];
The wrong approach
The wrong thing to do is to add the handle view to the view of the cell itself.
sometableviewcell.m
[Self removeallsubviews];
......
[Self addsubview:view];
In the removeallsubviews , not only remove the child view that you added, but also remove the UITableViewCell Contentview .
The consequences of the mistake
The result of the wrong approach is that the cell appears blank on IOS 7 (Beta version 7.1). All the subview are not showing up. Normal on iOS 6 and iOS 8.
The pit of the IOS UI: Do not remove UITableViewCell's Contentview