Sure, you just have to drag and create a segue from the first viewController to the second, and name it "segue0" for instance.
-(void)buttonTapped:(UIButton*)sender
{
NSInteger *index = [carousel indexOfItemViewOrSubview:sender];
if(index = 0)
{
[self performSegueWithIdentifier:@"segue0", sender:self];
}
//else if etc.., or better yet, ditch the if, do the checking in 'prepare' as explained below
}
-(void)prepareForSegue:(UIStoryboardSegue*) segue sender:(id)sender
{
YourNextViewController *nextView = [segue destinationViewController];
//Do stuff to your next view with "nextView"
}
If they are all going to the same viewController, but by sending different data in prepareForSegue, then you can ditch the if-statement
, and send sender
instead of self
as the sender in [self performSegue..]
, and check in prepareForSegue..
which button is the sender(or moving your NSInteger *index...
line down here)