我试图在 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];