我有一个 ASNetworkImageNode,它位于一个 constrainedSize 为 (320, 320) 的集合视图中,但在测量日志后显示 image.calculatedSize 为 (375, 375)。我在这里做错了吗?
#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);
}