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!

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


Navigation Bar Button

So I want to display a navigation bar button on the right side of a navigation bar if the user is a faculty member. To do this, I need to know how to add the Navigation bar button programmatically, set it to the right side, give it a title, and then a segue to where they can access another view controller by clicking the button. I know this is a lot, but you guys are always helpful.


Stone Preston
Stone Preston
42,016 Points

if you are trying to tag someone just type @ followed by their name. A box will pop up with an option to choose who you want to tag

1 Answer

Stone Preston
Stone Preston
42,016 Points
UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithTitle:@"Button" style:UIBarButtonItemStylePlain target:self action:@selector(myButtonPressed)];
[self.navigationItem setRightBarButtonItem:myButton];

- (void)myButtonPressed {
  //code for presenting next view controller goes here.