2012-07-27 27 views

回答

1

也許嘗試將共享NSURLCache設置爲適合您的應用程序的某些內容。

爲例見http://twobitlabs.com/2012/01/ios-ipad-iphone-nsurlcache-uiwebview-memory-utilization/

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    int cacheSizeMemory = 4*1024*1024; // 4MB 
    int cacheSizeDisk = 32*1024*1024; // 32MB 
    NSURLCache *sharedCache = [[[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"] autorelease]; 
    [NSURLCache setSharedURLCache:sharedCache]; 

    // ... more launching code 
} 
+0

是diskPath基本上只是一個字符串? – aherlambang 2012-07-27 04:47:42

+0

從[Apple的文檔](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html)path是應用程序的子目錄的名稱用於存儲磁盤緩存的默認緩存目錄(如果子目錄不存在,則創建該子目錄)。 – Adam 2012-07-27 04:50:33

+0

你能評論一下drawRect嗎? – aherlambang 2012-07-27 05:16:49