OLImageView icon indicating copy to clipboard operation
OLImageView copied to clipboard

A bug after dealloc OLImageView and solution

Open bestvista opened this issue 12 years ago • 1 comments

  • (void)displayLayer:(CALayer *)layer { if (!self.animatedImage || [self.animatedImage.images count] == 0) { return; } layer.contents = (__bridge id)([ [self.animatedImage.images objectAtIndex:self.currentFrameIndex] CGImage]); }

when image in self.animatedImage still a NSNull object, cause crash! May change to :

  • (void)displayLayer:(CALayer *)layer { if (!self.animatedImage || [self.animatedImage.images count] == 0) { return; } id image = [self.animatedImage.images objectAtIndex:self.currentFrameIndex]; if ([image isKindOfClass:[UIImage class]]) { layer.contents = (__bridge id)([image CGImage]); } }

bestvista avatar Oct 23 '13 02:10 bestvista

+1

Eeyore741 avatar Oct 30 '13 07:10 Eeyore741