我试图在uiscrollview中加载40个UIWebview。用户滚动超过5.收到的内存警告警报连续出现,最后应用程序退出。 如何管理这个内存问题,请告诉我。 在此先感谢
我试过了:
描述:在UIScrollview中添加逐个加载webview,因为我试图使用for循环单次加载所有webview,但是在for循环中应用程序崩溃,所以一个接一个地添加进程。
CGRect vFrame = self.view.frame;
UIWebView *wViewLocal = [[UIWebView alloc] initWithFrame:CGRectMake(vFrame.origin.x, vFrame.origin.y, vFrame.size.width, 900)];
wViewLocal.delegate = self;
wViewLocal.backgroundColor = [UIColor grayColor];
NSString *fileUrl = [[subSubChap objectAtIndex:selectedIndex] stringByReplacingOccurrencesOfString:@".htm" withString:@""];
[wViewLocal fileUrl baseURL:nil];
[wViewLocal setScalesPageToFit:YES];
[wViewLocal setContentMode:UIViewContentModeScaleToFill];
[wViewLocal setFrame:CGRectMake(selectedIndex*viewRect.size.width,0,768, 900)]; // here set X-Value each webview.
[wViewLocal setTag:selectedIndex];
[scroll_View addSubview:wViewLocal]; // Here i have add UIWebview
[self.array_MainObject addObject:wViewLocal]; // Here i have add all UIWebview in NSMutableArray for get particular webview info.
[wViewLocal release];