Balabama Balabama - 5 months ago 15
iOS Question

How to open new view controller after click button?

I added one

ViewController
to my project and created one class.
After I bind this class to my
ViewController
.

In another controller I have method:

- (IBAction)login:(id)sender {
// How here I can do redirect to controller
ViewController

}

iPR iPR
Answer

There are two ways to push view controllers in the application.

1) by Segue

2) By View controller identifier

1) By Segue :

[self performSegueWithIdentifier:"SegueIdentifier" sender:self];

2) By View controller identifier :

Yourclassname *gotoYourClass = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewControllerIdentifier"];

[self.navigationController pushViewController:gotoYourClass animated:YES];
Comments