iOS5的webView已经有磁盘缓存了

iOS5的webView磁盘缓存默认是20M,可以进行修改.或者覆盖缓存策略.

NSURLCache* testCache = [[NSURLCache alloc]initWithMemoryCapacity:1024*1024*20 diskCapacity:1024*1024*50 diskPath:@"mead.db"];
    [NSURLCache setSharedURLCache:testCache];
   
    unsigned int diskCapacity = testCache.diskCapacity;
    NSLog(@"my diskCapacity=%d",diskCapacity);
   
    [testCache setDiskCapacity:1024*1024*50];
    diskCapacity = testCache.diskCapacity;
    NSLog(@"after setting diskCapacity=%d",diskCapacity);
   
    diskCapacity = testCache.currentDiskUsage;
    NSLog(@" currentDiskUsage=%d",diskCapacity);
   
    diskCapacity = testCache.currentMemoryUsage;
    NSLog(@" currentMemoryUsage=%d",diskCapacity);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/174aeefab4b9cd1744a6163fef68c603.html