iphone - ARC - UIWebView/UIViewController is sticking around in memory? -


my old uiwebviews seem sticking around when using arc, reason still show in osx safari's developer tools after i've come out of uiviewcontroller.

i'm allocating transitioning view controller contains uiwebview, this:

    //create settings view/tabbar     uitabbarcontroller *tabcontroller = [[norotatetabbarcontroller alloc] init] ;      styleviewcontroller *styletab = [[styleviewcontroller alloc] initwithnibname:@"styleviewcontroller" bundle:nil];     styletab.tabbaritem.title = @"style";     styletab.tabbaritem.image = [uiimage imagenamed:@"eyeicon.png"];      nsarray *tabsarray = @[styletab];     tabcontroller.viewcontrollers = tabsarray;      prevview = self.window.rootviewcontroller;      [uiview         transitionwithview:self.window         duration:0.5         options:uiviewanimationoptiontransitionflipfromright         animations:^(void) {             bool oldstate = [uiview areanimationsenabled];             [uiview setanimationsenabled:no];             self.window.rootviewcontroller = tabcontroller;             [uiview setanimationsenabled:oldstate];         }     completion:nil]; 

i'm coming out of view this:

    [uiview         transitionwithview:self.window         duration:0.5         options:uiviewanimationoptiontransitionflipfromleft         animations:^(void) {             bool oldstate = [uiview areanimationsenabled];             [uiview setanimationsenabled:no];             self.window.rootviewcontroller = prevview;             [uiview setanimationsenabled:oldstate];         }     completion:nil]; 

the uiwebview (int styleviewcontroller) being created way:

    @implementation styleviewcontroller     uiwebview *webview;      //viewdidload     webview = [[uiwebview alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width, 1)];     webview.scalespagetofit = no;     webview.scrollview.scrollenabled = false;     webview.multipletouchenabled = false;     webview.alpha = 0;     webview.backgroundcolor = [uicolor clearcolor];     webview.opaque = false;      @end 

however, notice when inspect in safari, old uiwebviews appear stacking up, , old ones still show in menu. bug in safari's developer tools? there way ensure uiwebviews released?

the issue delegates. using webviewjavascriptbridge, , funky stuff delegates, needed rid of first. doing in viewwilldisappear selector kept them getting retained:

- (void) viewwilldisappear:(bool)animated { /* or dealloc */     [super viewwilldisappear:animated];      _bridge = nil;      //uiwebview #1     [webview removefromsuperview];     webview.delegate = nil; webview = nil;      //uiwebview #2     [textview removefromsuperview];     textview.delegate = nil; textview = nil; } 

thank excellent answers, regardless!


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -