Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8893e36

Browse files
author
Jim Puls
committed
Don’t ignore non-resizable images.
1 parentc989ec8 commit8893e36

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

‎assetgen/AGCatalogParser.m

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ - (void)parseImageSetAtURL:(NSURL *)url;
8484
return;
8585
}
8686

87-
NSUInteger resizableIndex = [[contents[@"images"]valueForKey:@"resizing"]indexOfObjectPassingTest:^BOOL(id obj,NSUInteger idx,BOOL *stop) {
88-
return obj != [NSNullnull];
89-
}];
90-
91-
if (resizableIndex ==NSNotFound) {
92-
return;
93-
}
94-
9587
NSString *interface = [NSStringstringWithFormat:@"+ (UIImage *)imageFor%@;\n", name];
9688
@synchronized(self.interfaceContents) {
9789
[self.interfaceContentsaddObject:interface];
@@ -119,13 +111,18 @@ - (void)parseImageSetAtURL:(NSURL *)url;
119111
[implementationappendFormat:@"%@ if ([UIScreen mainScreen].scale ==%.1ff) {\n", indentation, scale];
120112
[implementationappendFormat:@"%@ UIImage *baseImage = [UIImage imageNamed:@\"%@\"];\n", indentation, filename];
121113

122-
CGFloat top = [variant[@"resizing"][@"capInsets"][@"top"]floatValue] / scale;
123-
CGFloat left = [variant[@"resizing"][@"capInsets"][@"left"]floatValue] / scale;
124-
CGFloat bottom = [variant[@"resizing"][@"capInsets"][@"bottom"]floatValue] / scale;
125-
CGFloat right = [variant[@"resizing"][@"capInsets"][@"right"]floatValue] / scale;
126-
NSString *mode = [variant[@"resizing"][@"center"][@"mode"]isEqualToString:@"stretch"] ?@"UIImageResizingModeStretch" :@"UIImageResizingModeTile";
127-
128-
[implementationappendFormat:@"%@ return [baseImage resizableImageWithCapInsets:UIEdgeInsetsMake(%.1ff,%.1ff,%.1ff,%.1ff) resizingMode:%@];\n", indentation, top, left, bottom, right, mode];
114+
NSDictionary *resizing = variant[@"resizing"];
115+
if (resizing) {
116+
CGFloat top = [resizing[@"capInsets"][@"top"]floatValue] / scale;
117+
CGFloat left = [resizing[@"capInsets"][@"left"]floatValue] / scale;
118+
CGFloat bottom = [resizing[@"capInsets"][@"bottom"]floatValue] / scale;
119+
CGFloat right = [resizing[@"capInsets"][@"right"]floatValue] / scale;
120+
NSString *mode = [resizing[@"center"][@"mode"]isEqualToString:@"stretch"] ?@"UIImageResizingModeStretch" :@"UIImageResizingModeTile";
121+
122+
[implementationappendFormat:@"%@ return [baseImage resizableImageWithCapInsets:UIEdgeInsetsMake(%.1ff,%.1ff,%.1ff,%.1ff) resizingMode:%@];\n", indentation, top, left, bottom, right, mode];
123+
}else {
124+
[implementationappendFormat:@"%@ return baseImage;\n", indentation];
125+
}
129126

130127
[implementationappendFormat:@"%@ }\n", indentation];
131128

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp