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 Build a Self-Destructing Message iPhone App Designing and Starting the App A Storyboard with a Tab Bar Controller

Zdeněk Zemek
Zdeněk Zemek
4,430 Points

Problem to solve it... :(

I tried many methods how to solve it, but i am not succesfull. The last try was:

[tabBarController setSelectedIndex:2];

wrong.

Anybody could help pls?

Zdeněk Zemek
Zdeněk Zemek
4,430 Points

I hope it is clear. I have a problem with finish challenge in the course: Build a Self-Destructing Message iPhone App -> A Storyboard with a Tab Bar Controller lesson.

Task is: We just saw how to change tabs by tapping on them, but we can also do this programmatically using the selectedIndex property of UITabBarController. The tab bar controller in the example below has three tabs. Use dot-notation or the setSelectedIndex: method to set the 3rd tab as the selected tab. Note: The tabs are indexed just like arrays, meaning the 1st tab is at index 0.

But I do not know how to solve it.

3 Answers

Hope this helps

[self.tabBarController setSelectedIndex:2];

What was your solution?