Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

imaumac

macrumors member
Original poster
Oct 15, 2008
52
0
Please:
how should I remove a webView when call another ?

if I run my small app with activity monitor (instruments)
you can see each time you call a webView then the memory increases, and add 4 or 5 MB each time pressing the button (calling a local HTML)

my question is:
how can I remove a webView before call another webView please.

here is the url of the small proyect to see see the problem.

http://www.1572-8.com/zzz-xcode-testing/skeleton-html.zip

please help , and one more time thanks.
 
Please:
how should I remove a webView when call another ?

if I run my small app with activity monitor (instruments)
you can see each time you call a webView then the memory increases, and add 4 or 5 MB each time pressing the button (calling a local HTML)

my question is:
how can I remove a webView before call another webView please.

here is the url of the small proyect to see see the problem.

http://www.1572-8.com/zzz-xcode-testing/skeleton-html.zip

please help , and one more time thanks.

I did not download your code - but are you creating a whole new webview each time? I would create a single webview, and just load new content into it. It'll probably be faster too.
 
I try , but not works, it crash again when run on device.
please, I begging you, to help with this.

this is the new project updated, but crash again if run for 4 or 5 minutes. (on device)
could you tellme how use the same Webview and load new content in to it? please ?

or where can I find information to do it please ?
I realy , realy need it.

note:
here is my main code on Delegate.m

#import "skeletonAppDelegate.h"
#import "skeletonViewController.h"
@implementation skeletonAppDelegate

- (IBAction)IBAc_ojo1: (id)sender {
[jpg_hide setHidden:NO];
if (webView != nil)
[webView release];
webView = [[UIWebView alloc] initWithFrame:[myHTML_ojo1 bounds]];
NSString *filePath = [[NSBundle mainBundle] pathForResource:mad:"head-mandiblev" ofType:mad:"html"];
NSString *html = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES]];
[webView setScalesPageToFit:YES];
[myHTML_ojo1 addSubview:webView];
[butt_return_partes setHidden:NO];
[butt_return_menu setHidden:YES];
[bt_HEAD_mandible setHidden:YES];
[bt_html_2 setHidden:YES]; }

- (IBAction)IBAc_html_2: (id)sender {
[jpg_hide_2 setHidden:NO];
if (webView != nil)
[webView release];
webView = [[UIWebView alloc] initWithFrame:[myHTML_ojo2 bounds]];
NSString *filePath = [[NSBundle mainBundle] pathForResource:mad:"head-mandiblew" ofType:mad:"html"];
NSString *html = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES]];
[webView setScalesPageToFit:YES];
[myHTML_ojo2 addSubview:webView];
[butt_return_partes setHidden:NO];
[butt_return_menu setHidden:YES];
[bt_HEAD_mandible setHidden:YES];
[bt_html_2 setHidden:YES]; }

- (IBAction)IBAc_ojo1_hide: (id)sender {
[jpg_hide setHidden:YES];
[jpg_hide_2 setHidden:YES];
[butt_return_partes setHidden:YES];
[butt_return_menu setHidden:NO];
[bt_HEAD_mandible setHidden:NO];
[bt_html_2 setHidden:NO]; }

@synthesize window;
 
Code:
if (webView != nil)
[webView release];
webView = [[UIWebView alloc] initWithFrame:[myHTML_ojo1 bounds]];
//and
[myHTML_ojo1 addSubview:webView];

That's the code that makes a whole new webView - don't do this when you click the button. Do it once when the view is first shown.

Code:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"head-mandiblev" ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath] isDirectory:YES]];

That's the code that loads the HTML into the view. That's the stuff that you want to do when the button is pushed.
 
now is working... 7 days searching this.
thanks , vry thanks for your valuable help.!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.