在UIScrollview中添加webview中的内存警告问题?

时间:2013-10-03 12:28:49

标签: ipad memory-management uiwebview uiscrollview nsmutablearray

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

0 个答案:

没有答案