This repository was archived by the owner on Feb 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1088,7 +1088,13 @@ - (void)__layout
10881088 // with negative sizes after applying margins, which will cause
10891089 // measureWithSizeRange: on subnodes to assert.
10901090 if (!CGRectEqualToRect (bounds, CGRectZero)) {
1091+ // Handle placeholder layer creation in case the size of the node changed after the initial placeholder layer
1092+ // was created
1093+ if ([self _shouldHavePlaceholderLayer ]) {
1094+ [self _setupPlaceholderLayerIfNeeded ];
1095+ }
10911096 _placeholderLayer.frame = bounds;
1097+
10921098 [self layout ];
10931099 [self layoutDidFinish ];
10941100 }
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ - (instancetype)init
6060- (UIImage *)placeholderImage
6161{
6262 CGSize size = self.calculatedSize ;
63+ if (CGSizeEqualToSize (size, CGSizeZero)) {
64+ return nil ;
65+ }
66+
6367 UIGraphicsBeginImageContext (size);
6468 [[UIColor colorWithWhite: 0.9 alpha: 1 ] setFill ];
6569 UIRectFill ((CGRect){CGPointZero, size});
@@ -78,6 +82,8 @@ - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
7882
7983- (void )layout
8084{
85+ [super layout ];
86+
8187 CGSize textSize = _textNode.calculatedSize ;
8288 CGSize needyChildSize = _needyChildNode.calculatedSize ;
8389
Original file line number Diff line number Diff line change 1515
1616static CGFloat const kASDKLogoAspectRatio = 2.79 ;
1717
18+ @interface ASImageNode (ForwardWorkaround)
19+ // This is a workaround until subclass overriding of custom drawing class methods is fixed
20+ - (UIImage *)displayWithParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock ;
21+ @end
22+
1823@implementation SlowpokeImageNode
1924
20- + (UIImage *)displayWithParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock
25+ - (UIImage *)displayWithParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock
2126{
2227 usleep ( (long )(0.5 * USEC_PER_SEC) ); // artificial delay of 0.5s
2328
@@ -46,6 +51,10 @@ - (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
4651- (UIImage *)placeholderImage
4752{
4853 CGSize size = self.calculatedSize ;
54+ if (CGSizeEqualToSize (size, CGSizeZero)) {
55+ return nil ;
56+ }
57+
4958 UIGraphicsBeginImageContext (size);
5059 [[UIColor whiteColor ] setFill ];
5160 [[UIColor colorWithWhite: 0.9 alpha: 1 ] setStroke ];
Original file line number Diff line number Diff line change 1313
1414#import < AsyncDisplayKit/ASDisplayNode+Subclasses.h>
1515
16+ @interface ASTextNode (ForwardWorkaround)
17+ // This is a workaround until subclass overriding of custom drawing class methods is fixed
18+ - (void )drawRect : (CGRect)bounds withParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock isRasterizing : (BOOL )isRasterizing ;
19+ @end
20+
1621@implementation SlowpokeTextNode
1722
18- + (void )drawRect : (CGRect)bounds withParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock isRasterizing : (BOOL )isRasterizing
23+ - (void )drawRect : (CGRect)bounds withParameters : (id <NSObject >)parameters isCancelled : (asdisplaynode_iscancelled_block_t )isCancelledBlock isRasterizing : (BOOL )isRasterizing
1924{
2025 usleep ( (long )(1.0 * USEC_PER_SEC) ); // artificial delay of 1.0
2126
You can’t perform that action at this time.
0 commit comments