@@ -85,15 +85,30 @@ - (NSObject *)drawParameters
8585
8686- (id )willDisplayAsynchronouslyWithDrawParameters : (id <NSObject >)drawParameters
8787{
88- return rasterContentsCache ()->objectForKey ({_renderer.attributes , _renderer.constrainedSize });
88+ NSInteger userInterfaceStyle = 1 ;
89+ if (@available (iOS 13.0 , *)) {
90+ UIView *view = (UIView *)self.delegate ;
91+ if ([view isKindOfClass: UIView.class ]) {
92+ userInterfaceStyle = (NSInteger )view.traitCollection .userInterfaceStyle ;
93+ }
94+ }
95+ return rasterContentsCache ()->objectForKey ({userInterfaceStyle, _renderer.attributes , _renderer.constrainedSize });
8996}
9097
9198- (void )didDisplayAsynchronously : (id )newContents withDrawParameters : (id <NSObject >)drawParameters
9299{
93100 if (newContents) {
101+ NSInteger userInterfaceStyle = 1 ;
102+ if (@available (iOS 13.0 , *)) {
103+ UIView *view = (UIView *)self.delegate ;
104+ if ([view isKindOfClass: UIView.class ]) {
105+ userInterfaceStyle = (NSInteger )view.traitCollection .userInterfaceStyle ;
106+ }
107+ }
108+
94109 CGImageRef imageRef = (__bridge CGImageRef)newContents;
95110 NSUInteger bytes = CGImageGetBytesPerRow (imageRef) * CGImageGetHeight (imageRef);
96- rasterContentsCache ()->cacheObject ({_renderer.attributes , _renderer.constrainedSize }, newContents, bytes);
111+ rasterContentsCache ()->cacheObject ({userInterfaceStyle, _renderer.attributes , _renderer.constrainedSize }, newContents, bytes);
97112 }
98113}
99114
0 commit comments