Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed dequeue bug that removed a control from its proper cell
  • Loading branch information
noahmiller committed Apr 23, 2010
1 parent 06cd0ab commit 577af26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TTTableControlCell.m
Expand Up @@ -165,6 +165,10 @@ - (void)layoutSubviews {

// XXXjoe For some reason I need to re-add the control as a subview or else
// the re-use of the cell will cause the control to fail to paint itself on occasion
// --Noah: the reason is that the label of the cell is also getting added to the
// cell's content view, and its rect is filling the entire cell. This sort of fixes
// the bug by making sure that the control sits above the label (and is visible)
// rather than sitting below the label (and being hidden by it).
[self.contentView addSubview:_control];

This comment has been minimized.

Copy link
@jverkoey

jverkoey Apr 17, 2011

This is really interesting. Looks like we should probably do [self.contentView bringSubviewToFront:_control] instead.

_control.frame = CGRectMake(minX, floor(self.contentView.height/2 - _control.height/2),
contentWidth, _control.height);
Expand All @@ -187,7 +191,9 @@ - (id)object {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)setObject:(id)object {
if (object != _control && object != _item) {
[_control removeFromSuperview];
if (_control.superview == self.contentView) {
[_control removeFromSuperview];
}
TT_RELEASE_SAFELY(_control);
TT_RELEASE_SAFELY(_item);

Expand Down

0 comments on commit 577af26

Please sign in to comment.