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

Commit450f17c

Browse files
author
Jim Puls
committed
Don't cache resizable images
1 parentb3de4f7 commit450f17c

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

‎assetgen/AGCatalogParser.m

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ - (void)parseImageSetAtURL:(NSURL *)url;
131131
[implementationappendString:@"}\n"];
132132

133133
}else {
134-
[implementationappendFormat:@" UIImage *image = [[self imageCache] objectForKey:@\"%@\"];\n", name];
135-
[implementationappendString:@" if (image) {\n"];
136-
[implementationappendString:@" return image;\n"];
137-
[implementationappendString:@" }\n\n"];
134+
[implementationappendString:@" UIImage *image = nil;\n\n"];
138135

139136
for (NSDictionary *variant in variants) {
140137
if (!variant[@"filename"]) {
@@ -174,7 +171,6 @@ - (void)parseImageSetAtURL:(NSURL *)url;
174171
[implementationappendString:@"\n"];
175172
}
176173

177-
[implementationappendFormat:@" [[self imageCache] setObject:image forKey:@\"%@\"];\n", name];
178174
[implementationappendString:@" return image;\n"];
179175
[implementationappendString:@"}\n"];
180176
}
@@ -184,23 +180,6 @@ - (void)parseImageSetAtURL:(NSURL *)url;
184180
}
185181
}
186182

187-
- (NSString *)cacheMethodContents;
188-
{
189-
NSMutableString *contents = [NSMutableStringstring];
190-
191-
[contentsappendString:@"+ (NSCache *)imageCache;\n"];
192-
[contentsappendString:@"{\n"];
193-
[contentsappendString:@" static dispatch_once_t onceToken;\n"];
194-
[contentsappendString:@" static NSCache *imageCache = nil;\n"];
195-
[contentsappendString:@" dispatch_once(&onceToken, ^{\n"];
196-
[contentsappendString:@" imageCache = [NSCache new];\n"];
197-
[contentsappendString:@" });\n"];
198-
[contentsappendString:@" return imageCache;\n"];
199-
[contentsappendString:@"}\n"];
200-
201-
return contents;
202-
}
203-
204183
- (void)outputCode;
205184
{
206185
NSURL *currentDirectory = [NSURLfileURLWithPath:[[NSFileManagernew]currentDirectoryPath]];
@@ -224,7 +203,7 @@ - (void)outputCode;
224203
[interfacewriteToURL:interfaceURLatomically:YESencoding:NSUTF8StringEncodingerror:NULL];
225204
}
226205

227-
NSString *implementation = [NSStringstringWithFormat:@"//\n// This file is generated from%@.xcassets by objc-assetgen.\n// Please do not edit.\n//\n\n#import\"%@\"\n\n@implementation%@\n\n%@\n%@\n\n@end\n",self.catalogName, classNameH, className,self.cacheMethodContents, [self.implementationContentscomponentsJoinedByString:@"\n"]];
206+
NSString *implementation = [NSStringstringWithFormat:@"//\n// This file is generated from%@.xcassets by objc-assetgen.\n// Please do not edit.\n//\n\n#import\"%@\"\n\n@implementation%@\n\n%@\n\n@end\n",self.catalogName, classNameH, className, [self.implementationContentscomponentsJoinedByString:@"\n"]];
228207

229208
if (![implementationisEqualToString:[NSStringstringWithContentsOfURL:implementationURLencoding:NSUTF8StringEncodingerror:NULL]]) {
230209
[implementationwriteToURL:implementationURLatomically:YESencoding:NSUTF8StringEncodingerror:NULL];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp