Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Sai Kiran Dasika
PLUS
Sai Kiran Dasika
Courses Plus Student 7,278 Points

Programming a segue programatically

Hey guys does any one know how to perform a segue programatically in X code. I was actually trying out something cool for the photo bombers app in the iOS development section. This segue has to be between a bar button in the navigation bar in the top and a view controller.

2 Answers

Hook up a manual segue between the view controller that has the bar button item and the view controller that you're trying to navigate to by control + dragging from one view controller to the next. Click on the segue and give the segue a name in the Attributes Inspector in the "identifier" field. In your bar button item's IBAction put [self performSegueWithIdentifier:@"segueName" sender:self];