我需要所有人的澄清,那就是我正在實現一個iPad應用程序。在那我試圖下載和動畫的圖像。圖像數量應該超過100,000.我用來下載和添加到視圖中的代碼如下。內存管理
UIImageView* imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,100,100)];
NSData *receivedData=nil;
receivedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://path/prudently/iphone/image_s/e545afbf-4e3e-442e-92f9-a7891fc3ea9f/test.png"]];
imageView.image = [[UIImage alloc] initWithData:receivedData] ;
[subView addSubview:imageView];
[imageView release];
但是,我成功地將超過8000的圖像添加到我的子視圖後,我收到異常。我在從URL獲取數據時遇到了異常。還有一件事我不釋放子視圖,因爲一旦我下載它們,我需要動畫子視圖。
請給我你的suggessions
謝謝 Sekhar Bethalam。
你有什麼異常?您可能已經耗盡內存,在這種情況下,異常可能會在'+ [NSData dataWithContentsOfURL:]'或其調用的方法之一中。 – David 2010-08-12 12:04:55