ios - uiviewcontroller still retaining after remove from superview, is it retain cycle issue -


i have uiviewcontroller subclass abcviewcontroller.on button long press, open uipopover containing uiviewcontroller(addproduct) on abuton long press.the add product contains cancel button brings user abcviewcontrol.and in instruments allocation tool disappears.fine till point.some thing this..

-(void)openproductpopup:(int)productid action:(bool)action{  addproduct *addproduct = [[addproduct alloc] initwithnibname:@"addproductnew" bundle:[nsbundle mainbundle]]; [addproduct setproductid:productid]; [addproduct setisaddingproduct:action]; uinavigationcontroller *nav = [[uinavigationcontroller alloc]                                initwithrootviewcontroller:addproduct]; [addproduct setdelegate:self];***//weak in add product*** [addproduct setdatabasepath:databasepath]; [addproduct setbacktracker:nil]; [addproduct setarrcategories:self.arrcategoryforpopup]; uipopovercontroller *popover = [[uipopovercontroller alloc]  initwithcontentviewcontroller:nav];  popover.delegate = self; [popover setpopovercontentsize:cgsizemake(576 , 490) animated:no]; [popover presentpopoverfromrect:cgrectmake(512, 430, 1, 1) inview:self.view permittedarrowdirections:0 animated:yes]; self.popover=popover; [addproduct setpopup:popover];***//weak in add product*** addproduct = yes; 

}

the addproduct contains edit button opens seperate uiviewcontroller(addproductseparateviewcontroller).it (addproduct) contains cancel button.on cancel button click user comes abcviewcintroller.

**problem:**addproduct releases in process addproductseparateviewcontroller not released per allocation tools live object , dealloc breakpoint.

the code in addproduct open addproductseparateviewcontroller follows:

-(ibaction)edit:(id)sender {  [delegate openeditproductpage:self.productid action:no]; 

}

this delegate inform abcviewcontroller open addproductseparateviewcontroller.

-(void)openeditproductpage:(int)productid action:(bool)action{  [self.popover dismisspopoveranimated:yes];  [self openaddeditproductseparatepage:productid action:action]; 

}

-(void)openaddeditproductseparatepage:(int)productid action:(bool)action{  [self.searchbar resignfirstresponder];  self.issalesvuorderscreenhidden = yes; [self setcontrolvisibility:yes]; btnclockin.hidden=yes; btnlogout.hidden=yes; [btnback.titlelabel sethidden:no];  self.viewcontroller = [[addproductseparateviewcontroller alloc] init]; [self.viewcontroller setproductid:productid]; [self.viewcontroller setsalesvuscreen:self]; [self.viewcontroller setisaddingproduct:action]; [self.viewcontroller setdelegate:self]; [self.viewcontroller setdatabasepath:databasepath]; [self.viewcontroller setbacktracker:nil]; [self.viewcontroller setarrcategories:self.arrcategoryforpopup]; [self.viewcontroller.view setframe:cgrectmake(0,48,1024,self.view.frame.size.height-48)]; [self.view addsubview:self.viewcontroller.view]; 

}

the code in addproductseparateviewcontroller cancel follows:

-(ibaction)cancel:(id)sender {   [self.view removefromsuperview]; 

}

why addproductseparateviewcontroller not released in process.

thanks

if declare self.viewcontroller in abcviewcontroller strong property need make sure nil reference out when removing view.

just removing self.view superview not mean deallocated. should call (add delegate) abcviewcontroller when cancel: happens.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -