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 trialEilon Krauthammer
4,768 PointsI don't understand task 2
I don't really understand the instructions, help please? :)
3 Answers
Ben Falk
3,167 PointsIt's worded confusingly. I just tried it and got a successful answer, so maybe this explanation will help...
This challenge asks you to create a new UITabBarItem called tab, which should be set to the current active item in the tab bar (item number 3, also known as index 2). You should be able to use the array tabBarItems to access the items in the tab bar.
Hope that helps?
Christopher Dyer
3,634 PointsShouldn't the challenges be related to the preceding video?!? Shouldn't they be simple constructs in which all elements are clear - in question and code.
Normally, when stuck, a review of the tutorial not only provides the answer, but cements the details.
The only way to correctly answer these questions is to find the answers in the forum and paste them in. I've forgotten what the tutorial was about!
Eilon Krauthammer
4,768 PointsThank you very much :)
Eilon Krauthammer
4,768 PointsEilon Krauthammer
4,768 PointsI still don't understand :/
Ben Falk
3,167 PointsBen Falk
3,167 PointsHere is the exact question: The tabs are stored in an array named tabBarItems (line 9). Declare a UITabBarItem variable named tab and set it from tabBarItems. Use the selectedIndex we just set as the index for the tab you get from the tabBarItems array.
I'm not sure how better to explain it... Here's the correct answer for task 2:
With this code, I am creating a new UITabBarItem called tab. Its value is set using the tabBarItems array created earlier in the code, which is an array of individual tab bar items. Since it's an array, I can use square brackets to access specific items within the array, so I am selecting the currently selected index from the tabBarController (which was just set in the first line), as the instructions ask.