views:

58

answers:

2

I have 3 view controllers. Main view (controller1's view) is displayed first. Based on button selection the 2nd view (controller2's view) is displayed. There are several buttons and a home button on this view. Selecting those will display 3rd view (controller3's view) with animation.Selecting home button will display the main view(controller1' view). The issue I have is when I press buttons on controller2's view to display controller3's view, during animation I see the controller1's view in the background. How can I get rid of that?

A: 

You could remove controller1's view from the superview before the animation sequence. You should be doing this as part of the transition from controller1 to controller2.

[controller1.view removeFromSuperView];

Of course, you will need to add it back in at some point.

Rob Jones
I have to have this line of code in the 2nd controller's file. How do I remember the 1st controller? Should I pass it as argument? I am not sure how to do it.
phonydev
Are you using a UIView animation block? If so, it should be part of that block. Which means in would be in the first controller, or the action method for the button push.
Rob Jones
+1  A: 

Sounds like you might want to use presentModalViewController. That probably wont fix your other problem with view1 being visible during the animation. I'd try and set the hidden property to use for view1.

willcodejavaforfood