tags:

views:

28

answers:

1

I added a subview using

myViewController *myVC = [[myViewController alloc] initWithNibName:@"myView" bundle:nil];
[self addSubview:myVC.view];
[myVC release];

how can I remove it again from a myViewController method ?

I tried

[self.view removeFromSuperview];

but that doesn't work

+4  A: 

Try this:

[myVC.view removeFromSuperview]
Diederik Hoogenboom
I tried to do this by adding a back button with an IBAction to my Subview calling from the subViewController:[self.view removefromsuperview], but that doesn't work.
iFloh
I got a step further on this. I add the subview from a UIScrollView. Clicking the back-button on the added view seems to interfere with the touch events ... for a separate discussion
iFloh