Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

[ASNetworkImageNode] placeholder will fadeout twice #563

@yxztj

Description

@yxztj

Hi,

When I'm using ASNetworkImageNode the placeholder is not working as we expected.
In the Placeholder sample which is included in the repo, the logo image is set to imageNode right after node is initialized. The placeholder is working just fine.

  // ASImageNode gets placeholders by default
  _imageNode = [[SlowpokeImageNode alloc] init];
  _imageNode.image = [UIImage imageNamed:@"logo"];

But if I delay setting the image by several seconds(5 seconds for example) as follows:

  // ASImageNode gets placeholders by default
  _imageNode = [[SlowpokeImageNode alloc] init];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        _imageNode.image = [UIImage imageNamed:@"logo"];
    });

The placeholderlayer will fadeout at start, then removed from superlayer, and when setting image on 5 seconds later, the placeholderlayer is added to node layer again, fadeout, and removed from superlayer:
image2times

After some research on the source code, I found that the placeholderlayer is added to node on each displayWillStart, and fadeout on each displayDidFinished().
As a result in ASNetworkImageNode, the placeholder is fading out twice(once on initial display, and another on image downloaded). Is this the expected behavior or am I missing anything? How can I prevent the first fade out from happening, since the network image hasn't finished downloading yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions