Skip to content

Instantly share code, notes, and snippets.

@randomsequence
Created May 28, 2013 12:45
Show Gist options
  • Save randomsequence/5662517 to your computer and use it in GitHub Desktop.
Save randomsequence/5662517 to your computer and use it in GitHub Desktop.
@interface ChildSelectedCell : UITableViewCell
@property (nonatomic) BOOL childSelected;
@end
@implementation ChildSelectedCell
- (void)setChildSelected:(BOOL)childSelected {
if (childSelected == _childSelected) return;
_childSelected = childSelected;
if (childSelected) {
UIView *backgroundView = [[UIView alloc] initWithFrame:self.bounds];
backgroundView.backgroundColor = [UIColor blueColor];
self.backgroundView = backgroundView;
} else {
self.backgroundView = nil;
}
}
- (void)prepareForReuse {
[super prepareForReuse];
self.childSelected = NO;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment