I want to remove the current subview (added atIndex:0) from my root view controller and insert a new view in its place.
Currently I can only find code snippets that show unloading a view using removeFromSuperView, which requires you to know what viewcontrollers view is currently loaded.
The only other thing to note is that I have another subview inserted in the rootcontrollers view which i dont want unloaded. So code that removes any and all subviews is not adequate
Thanks,
m
if(self.firstscr == nil) { firstscreen *f = [[firstscreen alloc] initWithNibName:@'firstscreenview' bundle:nil]; self.firstscr = f; [f release]; } ///This is my attempt at getting to the currently loaded view :P [[self.view subviews atIndex:0].view removeFromSuperView]; [self.view insertSubview:firstscr.view atIndex:0];
Here is how to do it (i figured it out, Yey me!)