uiviewcontroller - Remove ViewController on ButtonClick event from superview -


I am trying to remove two view controllers with one method (which have been added above each other) I have made an idea in the interface maker

I am in the scenario:

I have a main menu in which the View 2 header file has been imported. In one method I add another view at the top of the supervision like

  view2ViewController * view2 = [[view2ViewController alloc] initWithNibName: @ "view2ViewController" bundle: zero]; [Self.view addSubview: view2.view];   

Then I have added the View3 header file in scene 2, so I can show View 3 as sub-view on View 2. I have another method that is connected to the interface builder in a UIButton, after pressing on the button, the method is called 2, which adds up to 3 views in the same way:

  view3ViewController * View 3 = [[View 3ViewController alloc] initWithNibName: @ "View 3ViewController" bundle: Zero]; [Self.view addSubview: view3.view];   

What is trying to solve the problem: I have a button in scene 3, which should remove scene 3. And then it should also remove 2 so that The main screen is visible. / P>

How can this be achieved?

What do I have so far:

  [self.view removeFromSuperview];   

It only removes 3 scenes ... but leaves 2 in places.

Need to be modified so that I also remove View 2 ??

Any help is appreciated.

Suppose you remove the scene in the same way you added a view, You've added a view by pressing it in the Navigation Controller like this

  [self.navigationController pushViewController: yourViewController Animated: Yes];   

Then you can call it your VICIL M file will need to be written in

  //inYourViewController.m file [self.navigationController popViewControllerAnimated: Yes];  

Make new edits:

OK, so let's say that you have currently created Model Vij controller.

Now, your second question where you want to go to View1 instead of View2. Create a Boolean variable in your AppDelegate, set it when you press the button made in View 3.

  //inYourAppDelegate.hBOOL doneBtnClicked = NO; //inYourViewController3.m - (IBAction) doneBtnPressed: (ID) sender {// your code yourAppDelegate * appDelegate = [[UIApplication shared application] representative]; AppDelegate.doneBtnClicked = Yes; & Gt; & Gt; Change this [self.view removeFromSuperview]; }   

Now, in your view 2, in the View Options Method

  - (zero) visible on API: (BOOL) animated {[Super ViewWhipper: Animated]; // Your code yourAppDelegate * appDelegate = [[UIApplication shared application] representative]; If (appDelegate.doneBtnClicked) {appDelegate.doneBtnClicked = NO; & Gt; & Gt; And this [self.view removeFromSuperview]; However}  Anyway,  what you want to do is very easily possible with the help of the UIA controller. I recommend you with the help of navigation, because it will actually be easy in terms of memory management and in addition to this, the Navigation Controller is for this purpose only.   

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -