Skip to content

Commit 8e66d9d

Browse files
authored
Appropriately convert colors with 0 alpha to UIColor.clearColor (#76)
* Return appropriate object of for all colors with 0 alpha. * Update PSPDFKitPlugin.m Improve comments
1 parent 20381e7 commit 8e66d9d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PSPDFKitPlugin/PSPDFKitPlugin.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ - (UIColor *)colorWithString:(NSString *)string
186186
if ([components count] > 3) {
187187
alpha = [[components[3] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] floatValue];
188188
}
189+
190+
// Return clear color if the alpha of the value supplied is 0.
191+
// We internally check for clearColor when saving colors for the last used color. See #20042
192+
if (alpha == 0) {
193+
return [UIColor clearColor];
194+
}
195+
189196
if ([components count] > 2) {
190197
NSString *red = [components[0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
191198
NSString *green = [components[1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

0 commit comments

Comments
 (0)