views:

30

answers:

2

Hi!

Following Scenario:

I have a = UIViewController A that contains a UIScrollView

I have a second UIViewController "B" (amongst other things it contains a button) and add it to the ScrollView of A

myView *mView = [[myView alloc] init]; [myScrollView addSubview:mView.view];

Is there a way that once the button is pressed that it(view) removes itself from the scrollview?

I thought in the direction of setting the delegate of mView to "A" ?! But not sure how that should work in detail....

Any suggestions? Thanks!

+1  A: 

In the controller, you can call:

[self.view removeFromSuperview];
Philippe Leybaert
A: 

If you have a reference to view you can do the following:

[view removeFromSuperview];

If you don't have a reference, please post more code and I can modify my answer for you.

rickharrison