Reputation: 49
My doubt is how do i move from one view to another.
I have one storyboard in which i have two view controller (i have just created 2nd view controller by dragging and dropping it). I want to move from one view to another using swipe . For this i have used swipe gesture and dragging its icon to our implementation file(viewController.m)Thereby creating a IBAction.
After that i am not sure what to do so that by 2nd view controller get loaded how to solve this problem and what to write in IBAction method.
Upvotes: 0
Views: 134
Reputation: 1096
Just use the fallowing line of code to navigate from one vc to second
- (IBAction)Goto_Next_View
{
// If you wanted to present the next vc modally you can use,
[self presentViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"Your_SecondVC_Identifier_In_Storyboard"] animated:true completion:nil];
// Or
// If you need to push on to navigation controller stack,You can use fallowing one.
[self pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"Your_SecondVC_Identifier_In_Storyboard"] animated:true completion:nil];
**// Please use only anyone of the above two options.**
}
HTH!Enjoy Coding :)
Upvotes: 1
Reputation: 1152
You have to create a segue
from one view controller to another view controller.
[self performSegueWithIdentifier:@"identA" sender:self];
Here "identA
" is the segue
name which is given in storyboard when connecting one view controller to another view controller.
Upvotes: 1