Ios ASNetworkImageNode的calculatedSize大于constrainedSize after-measure

Ios ASNetworkImageNode的calculatedSize大于constrainedSize after-measure,ios,asyncdisplaykit,Ios,Asyncdisplaykit,我有一个ASNetworkImageNode,它位于constrainedSize为(320320)的集合视图中,但在测量日志后显示image.calculatedSize为(375175)。我有什么地方做错了吗 #pragma mark - ASCellNode Delegate - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize { CGSize availableSize = CGSizeMake(constrained

我有一个ASNetworkImageNode,它位于constrainedSize为(320320)的集合视图中,但在测量日志后显示image.calculatedSize为(375175)。我有什么地方做错了吗

#pragma mark - ASCellNode Delegate

- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
{
    CGSize availableSize = CGSizeMake(constrainedSize.height, constrainedSize.height);
    CGSize imageSize = [image measure:availableSize];

    NSLog(@"constrainedSize width: %lf and height: %lf", availableSize.width, availableSize.height);

    NSLog(@"measured image size width: %lf and height: %lf", imageSize.width, imageSize.height);

    return imageSize;
}

- (void)layout
{
    CGSize imageSize = image.calculatedSize;
    image.frame = CGRectMake(0, 0, imageSize.width, imageSize.height);
}

默认情况下,ASImageNodes将返回其加载的图像的大小,您需要将图像的帧设置为所需的大小,而不是:

image.frame=CGRectMake(0,0,imageSize.width,imageSize.height)

使用

image.frame=CGRectMake(0,0,bounds.width,bounds.height)

或者确保您下载的图像与您要查找的图像大小完全一致