self是实例的指针,[self class]是类的指针,静态方法得用类的指针来调用
- (NSString*) pathForImageURL:(NSString*)imageURL {
if ([imageURL hasPrefix:@"http://"] || [imageURL hasPrefix:@"https://"] || [imageURLhasPrefix:@"ftp://"])
return [[self class] tmpFilePathForResourceAtURL:imageURL];
return imageURL;
}
+ (NSString*) tmpFilePathForResourceAtURL:(NSString*)url {
NSString * fileName = [self fileNameForResourceAtURL:url];
NSString * path = [self filePathForTemporaryStorage];
return [path stringByAppendingPathComponent:fileName];
}
时间: 2024-10-10 12:15:30