Skip to content

Commit

Permalink
Fix issue where image layer content remain
Browse files Browse the repository at this point in the history
When using in a UITableView fix issue where new layer content are added
but not cleared out.
  • Loading branch information
sebhopley committed Nov 13, 2014
1 parent 3a1eadf commit 1ce2c55
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions UIImageViewAligned/UIImageViewAligned.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ - (id)initWithFrame:(CGRect)frame
return self;
}


- (id)initWithImage:(UIImage *)image
{
self = [super initWithImage:image];
Expand Down Expand Up @@ -182,17 +181,31 @@ - (CGSize)realContentSize

#pragma mark - UIImageView overloads

- (void)setHighlighted:(BOOL)highlighted {
- (void)setHighlighted:(BOOL)highlighted
{
[super setHighlighted:highlighted];
self.layer.contents = nil;
}

- (void)didMoveToWindow
{
[super didMoveToSuperview];
self.layer.contents = nil;
}

- (void)didMoveToSuperview
{
[super didMoveToSuperview];
self.layer.contents = nil;
}

#pragma mark - Properties needed for Interface Builder

- (BOOL)alignLeft
{
return (_alignment & UIImageViewAlignmentMaskLeft) != 0;
}

- (void)setAlignLeft:(BOOL)alignLeft
{
if (alignLeft)
Expand All @@ -205,6 +218,7 @@ - (BOOL)alignRight
{
return (_alignment & UIImageViewAlignmentMaskRight) != 0;
}

- (void)setAlignRight:(BOOL)alignRight
{
if (alignRight)
Expand All @@ -213,11 +227,11 @@ - (void)setAlignRight:(BOOL)alignRight
self.alignment &= ~UIImageViewAlignmentMaskRight;
}


- (BOOL)alignTop
{
return (_alignment & UIImageViewAlignmentMaskTop) != 0;
}

- (void)setAlignTop:(BOOL)alignTop
{
if (alignTop)
Expand All @@ -230,6 +244,7 @@ - (BOOL)alignBottom
{
return (_alignment & UIImageViewAlignmentMaskBottom) != 0;
}

- (void)setAlignBottom:(BOOL)alignBottom
{
if (alignBottom)
Expand Down

0 comments on commit 1ce2c55

Please sign in to comment.