Skip to content
Browse files

Fixed nasty caching issue :grin:

  • Loading branch information...
1 parent d3e14a3 commit 2d255f075fe53ad10afe8eb65666207a8f2c65d0 @tmdvs committed
Showing with 12 additions and 8 deletions.
  1. +12 −8 TDBadgedCell (xcode project)/TDBadgedCell.m
View
20 TDBadgedCell (xcode project)/TDBadgedCell.m
@@ -50,11 +50,11 @@ - (void) drawRect:(CGRect)rect
colour = __badgeColorHighlighted;
else
colour = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.000f];
- else
- if (__badgeColor)
- colour = __badgeColor;
- else
- colour = [UIColor colorWithRed:0.530f green:0.600f blue:0.738f alpha:1.000f];
+ else
+ if (__badgeColor)
+ colour = __badgeColor;
+ else
+ colour = [UIColor colorWithRed:0.530f green:0.600f blue:0.738f alpha:1.000f];
// Create the layer for drawing the badge
@@ -92,7 +92,7 @@ - (void) drawRect:(CGRect)rect
// Draw the image into the badgeView
[outputImage drawInRect:rect];
-
+
// Set any additional styles for select states
if((__parent.selectionStyle != UITableViewCellSelectionStyleNone) && (__parent.highlighted || __parent.selected) && __showShadow)
{
@@ -156,7 +156,9 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
- (void)configureSelf
{
// Initialization code
- __badge = [[TDBadgeView alloc] initWithFrame:CGRectZero];
+ if(!__badge)
+ __badge = [[TDBadgeView alloc] initWithFrame:CGRectZero];
+
self.badge.parent = self;
self.badgeLeftOffset = 10.f;
@@ -188,6 +190,8 @@ - (void) layoutSubviews
if(self.badgeString)
{
+ [self configureSelf];
+
// Force badges to hide on edit.
if(self.editing)
[self.badge setHidden:YES];
@@ -239,7 +243,7 @@ - (void) layoutSubviews
}
else
{
- [self.badge setHidden:YES];
+ [self.badge removeFromSuperview];
}
}

0 comments on commit 2d255f0

Please sign in to comment.
Something went wrong with that request. Please try again.