Skip to content

Commit

Permalink
Support image in the disk for MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
loongliu committed Jan 17, 2019
1 parent 113f437 commit d8a3257
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lottie-ios/Classes/AnimatableLayers/LOTLayerContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ - (void)_setImageForAsset:(LOTAsset *)asset {
if (asset.imageName) {
NSArray *components = [asset.imageName componentsSeparatedByString:@"."];
NSImage *image = [NSImage imageNamed:components.firstObject];
if (image == nil) {
if (asset.rootDirectory.length > 0 && asset.imageDirectory.length > 0) {
NSString *imagePath = [[asset.rootDirectory stringByAppendingPathComponent:asset.imageDirectory] stringByAppendingPathComponent:asset.imageName];
image = [[NSImage alloc] initWithContentsOfFile:imagePath];
}
}
if (image) {
NSWindow *window = [NSApp mainWindow];
CGFloat desiredScaleFactor = [window backingScaleFactor];
Expand Down

0 comments on commit d8a3257

Please sign in to comment.