Fix retain cycle in basic, cache-less ASNetworkImageNodes

This should not directly affect more complex apps that don't use the ASBasicImageDownloader.

Also disables the default-on text placeholders, as they churn memory during the measurement pass.
These were intended to be written with pure layers (without using backing stores), so I don't
think it is a reasonable default-on behavior until that is fixed.
This commit is contained in:
Scott Goodson
2015-10-30 22:42:05 -07:00
parent ed63577370
commit 3175ce2fe7
7 changed files with 31 additions and 11 deletions

View File

@@ -131,7 +131,8 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
_constrainedSize = CGSizeMake(-INFINITY, -INFINITY);
// Placeholders
self.placeholderEnabled = YES;
// Disabled by default in ASDisplayNode, but add a few options for those who toggle
// on the special placeholder behavior of ASTextNode.
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
_placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0);
}
@@ -747,6 +748,8 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
- (UIImage *)placeholderImage
{
// FIXME: Replace this implementation with reusable CALayers that have .backgroundColor set.
// This would completely eliminate the memory and performance cost of the backing store.
CGSize size = self.calculatedSize;
UIGraphicsBeginImageContext(size);
[self.placeholderColor setFill];