tags:

views:

36

answers:

2

At some part of my code I am using this line

[[self navigationController] pushViewController:myController animated:YES];

This works perfectly and pushes a view, coming from bottom, over the current one, covering the last one completely.

I am wondering if there's a way to make it cover just part of screen. Let's say, just the half bottom of the screen...

Is it possible? I have tried to change the controller's view frame but the size kept coming full screen.

thanks.

+2  A: 

You can do it in a limited fashion with a modal view controller. Check out the presentation options available under UIModalPresentationStyle in the apple docs.

You will need to be on iOS 3.2 or above to do a modal view controller.

Ben
Good suggestion, but I don't think this gives you the option of non-full-screen on an iPhone ("On iPhone and iPod touch devices, modal view controllers are always presented full-screen, but on iPad devices there are several different presentation options.")
David Gelhar
On iPad I am using popovers but for iPhone my problem is that I am developing for 3.0 and up and I suspect, as David Gelhar said, I will be out of luck.... unless I fake it using a regular view animation.
Digital Robot
+2  A: 

Instead of using a new view controller modally, you could add a new subview to your existing view, using the same view controller.

You can do the "slide in" animation with something like:

[self.view addSubview: newView];

CGRect endFrame = newView.frame; // destination for "slide in" animation
CGRect startFrame = endFrame; // offscreen source

// new view starts off bottom of screen
startFrame.origin.y += self.view.frame.size.height;
self.newImageView.frame = startFrame;

// start the slide up animation
[UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.3];   
    newView.frame = endFrame; // slide in
[UIView commitAnimations];
David Gelhar