How to push a view controller to another view controller

Total Post:145

Points:1019
 892  View(s)
Ratings:
Rate this:
I am new in iPhone development, so I want to know how can I push one view controller to another view controller using animations.
I have added a Next button. whenever I click that button I am pushing one view controller to another view controller.
Please help me.
  1. Post:214

    Points:1642
    Re: How to push a view controller to another view controller

    If you want to push one view to another view controller then you need to implement below code in action method of your Next button:

    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    ImageViewController *imageViewController = (ImageViewController*)[mainstoryboard instantiateViewControllerWithIdentifier:@"ImageViewController"];

    or in short you can use above code like this:

    ImageViewController *imageViewController = [self.storyboard instantiateViewControllerViewIdentifier:@"ImageViewController"];

    I hope above code is helpful for you.

Answer