ios - Remove viewcontroller & move to next view controller -


hi have been working on ios app.what doing navigating among diffrent view controllers. problem want finish current view controller emoery , move next view controller.

i using `[self.view removefromsuperview]; finishing cureent view & using

 self.loginview = [self.storyboard instantiateviewcontrollerwithidentifier:@"login"];     [self presentviewcontroller:self.loginview animated:no completion:nil]; 

for moving next view controller thing not able remove memory.

please tell me how can it?

thanks in advance.

`

it's better create container view controller manages view controllers. example, in viewdidload: of container controller add current controller:

[self addchildviewcontroller:self.currentviewcontroller]; [self.currentviewcontroller didmovetoparentviewcontroller:self]; [self.view addsubview:self.currentviewcontroller.view]; //here set currentviewcontroller view's frame or constraints if needed 

when need open login controller, this:

[self addchildviewcontroller:loginviewcontroller]; [self.loginviewcontroller didmovetoparentviewcontroller:self]; [self.view addsubview:loginviewcontroller.view]; //here set loginviewcontroller view's frame or constraints if needed  //then remove current view controller [self.currentviewcontroller willmovetoparentviewcontroller:nil]; [self.currentviewcontroller removefromparentviewcontroller]; [self.currentviewcontroller.view removefromsuperview]; 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -