I m experimenting with a magazine kind of iPad app that I develop and I ran into a memory issue. There are multiple UIWebView-s on a UIScrollView. Every UIWebView displays an html page each from html file source. Unfortunately I couldn t find the solution to handle the web views to load them smoothly in the background once the app loaded, instead of that it loads and fires every html pages with all its javascripts and images, because I want them to be visible once I swipe through on them, hovewer I get "Received memory warning" message at 30 panels and the app breaks.
我用来展示网络看法的守则是:
NSInteger numberOfViews = 47;
for (int i = 0; i < numberOfViews; i++) {
CGFloat yOrigin = i * 768;
DetailViewController *detailViewController2 = [[DetailViewController alloc] initWithNibName:@"Detail" bundle:nil];
[detailViewController2.view setFrame:CGRectMake(yOrigin, 0, 768, 1024)];
detailViewController2.view.clipsToBounds = YES;
[scroll.view insertSubview:detailViewController2.view atIndex:0];
}
scroll.scrollView.contentSize = CGSizeMake(768 * numberOfViews,1004);
scroll.pageControl.numberOfPages = numberOfViews;
self.view.clipsToBounds = YES;
self.view.clearsContextBeforeDrawing = YES;
CGRect frame;
frame.origin.x = scroll.scrollView.frame.size.width * scroll.pageControl.currentPage;
frame.origin.y = 0;
frame.size = scroll.scrollView.frame.size;
[scroll.scrollView scrollRectToVisible:frame animated:NO];
self.scrollViewController = scroll;
[self.view insertSubview:scroll.view atIndex:0];
- (void)dealloc {
[scrollViewController release];
[tableOfContentsViewController release];
[portrait release];
[tableOfContents1 release];
[start release];
[super dealloc];
}
显示html内容的法典载于DetaildViewController:
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:htmlfilename
ofType:@"html"
inDirectory:@"/htdocs" ];
NSString *html = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding
error:nil];
web.delegate = self;
[web setMultipleTouchEnabled:YES];
[web loadHTMLString:html
baseURL:[NSURL fileURLWithPath:
[NSString stringWithFormat:@"%@/htdocs/",
[[NSBundle mainBundle] bundlePath]]]];
- (void)dealloc {
//---release the memory used by the property---
[page release];
[web setDelegate:nil];
[web stopLoading];
[web release];
[orientation release];
[page release];
[super dealloc];
}
问题在于,我如何能够顺利地把他们装在《联合国国际数据集》的背部,而且,一旦小组向观察所投放,我计划用其html页显示60多份网站概览,我只能向该报社开火?