我正在编写一个应用程序,将我们的一个网站加载到UIWebView中。为了加快加载时间,我创建了NSURLCache的子类,它检查NSDictionary以查看图像是否存在于本地,如果是,它使用本地图像而不是请求在线版本。我有一个问题,一些图像具有相同的名称,但在不同的文件夹中。这是我的NSDictionary:
[NSDictionary dictionaryWithObjectsAndKeys:
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/1-Star/1-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/2-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/2-Star/2-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/3-Star/3-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/3-Stars.png",
@"4-Stars.png", @"https://www.xxx.com/content/star-bar/4-Star/4-Stars.png",
@"1-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/1-Stars.png",
@"2-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/2-Stars.png",
@"3-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/3-Stars.png",
@"4-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/4-Stars.png",
@"5-Stars.png", @"https://www.xxx.com/content/star-bar/5-Star/5-Stars.png",
nil];
在may app中我的图像与在线文件夹结构相同,所以如何告诉'https://www.xxx.com/content/star-bar/1-Star/1-Stars的请求.png'使用正确的图像,而不是用于“https://www.xxx.com/content/star-bar/2-Star/1-Stars.png”的图片?
我希望这很清楚!