Pangolin
Pangolin

Reputation: 7444

iPhone - Remove view and NavigationController

I have a ViewController which creates a NavigationController and puts a UIView in it.

nvcontrol =[[UINavigationController alloc] initWithRootViewController:menuView];
...
UIView *parent = self.view.superview;
[parent addSubview:nvcontrol.view];

I need to close the view (incl. the NavController) from within the child-viewcontroller.

The following snippet I tried, only closes the view inside the NavController, not the NavController itself. This ends up showing the blue head with a white space below.

[self.view removeFromSuperview];

What could solve this?

Upvotes: 1

Views: 3593

Answers (2)

Nitin Alabur
Nitin Alabur

Reputation: 5812

@traingle_man Are you sure view is a property of uinavigation controller?

If I understand your question correct, this may help

[nvcontrol.view removeFromSuperview];

Upvotes: 0

triangle_man
triangle_man

Reputation: 1092

I have not tried this but I think something like this should work:

[self.navigationController.view removeFromSuperview];

Upvotes: 2

Related Questions