iphone - iOS - removeFromSuperview removing too many views -


In my app my main window is View 1 and View 2.

View1 is loaded through a button in the main window and view 2 is loaded in view 1 through a UITable view.

That's why I call [self.window addSubview: View1] .

When I close View2 with [code] [self.view removeFromSuperview] I work back to MainWindow for no reason and no View1.

Any thoughts as to what is happening?

You must ensure that the self View2 ' It will depend on where you are calling [self.view removalFromSuperview] .

If you are not calling within the controller for View 2, then it can work anywhere:

  [View2 removeFromSuperview];    

Comments