8

I am new to iPhone SDK. I am using the following code but the animation happens from right to left when I click this button. I want to do from bottom to top.

- (IBAction)clickedsButton:(id)sender
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDuration:0.75];
    [self.navigationController pushViewController:settingsController animated:TRUE];
    [UIView commitAnimations];
}

setAnimationTransition supports only two:

  1. UIViewAnimationTransitionFlipFromLeft
  2. UIViewAnimationTransitionFlipFromRight

I used following, but it is not working:

settingsController.modalTransitionStyle =  UIModalTransitionStyleCoverVertical;
[self.navigationController pushViewController:settingsController animated:YES];
HangarRash
  • 7,314
  • 5
  • 5
  • 32

2 Answers2

5

What you're looking for is

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated;
Jasarien
  • 58,279
  • 31
  • 157
  • 188
  • 2
    i want to do that,through PUSHVIEWCONTROLLER only.because i had used popviewcontroller in that next view controller(settingsController) will presentModalViewController support popviewcontroller.... –  Oct 24 '09 at 12:21
  • 3
    the opposite to presentModalViewController:animated: is dismissModalViewController:animated: – Jasarien Oct 24 '09 at 12:43
  • It is an Apple intention that popViewController is animated from right to left. It enforces user interaction design, and you should be following Apple's Human Interface Guidelines. The animation from bottom to top is for modal views. – Jasarien Oct 24 '09 at 12:45
  • 1
    I'm not wrong. Everything I said was 100% correct. Just because you CAN do something, doesn't mean you SHOULD. Either way, congrats on finding a solution. – Jasarien Mar 10 '10 at 09:43
0

SWIFT 3

self.present(newViewController, animated: true, completion: nil)
MANISH PATHAK
  • 2,602
  • 4
  • 27
  • 31