Advertise with us

How to push a view controller to another view controller

Posted by  ezra heywood
 1166  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. 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