Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Crystal Ball Prediction Display

I just got done with the randomization video. It's working for the most part but my iOS simulator is getting cut off for some answers. For ex. it properly displays the full prediction "Definitely" because it's short, but for longer predictions like "Concentrate and try again" it produces "Concentrate..." In other words, it doesn't include the whole answer. Does anyone know why it's doing this?

Thanks in advance.

3 Answers

Ashley Kelley
PLUS
Ashley Kelley
Courses Plus Student 10,554 Points

Hi Jimmy,

You need to change the size of the box that the text goes into on your main dashboard or alter the font size. So if you go to your editor, on the right it allows you to type in the text, change font and center text etc. There you can you should try altering your font size and/or the size of the box itself.

I tried doing so but still doesn't work. Another issue is that after I click predict, it randomizes another prediction but the new prediction after the first one is in black color instead of white color. How do I apply the white color to all items in array on XCode? Thanks in advance!

Also on the side note, my iPhone simulator's default position is horizontal- do you know how to change that to vertical?

Ashley Kelley
PLUS
Ashley Kelley
Courses Plus Student 10,554 Points

For the simulator, go to the tool bar at the top and select Hardware, then just click rotate right or left, depending on which your simulator is currently facing.

For the text, if you got your storyboard, and click on your text box which displays the predictions, you should be able to extend the width of that box just by clicking and dragging to your desired width. To ensure the colour is white, select the text box and go to your editor pane (attributes inspector) on the right hand side. Here you can select the text colour, font size etc and center it. This should resolve the problem.

Unless you've specified a colour in your code, the one you select here will apply to all text in this box.

Ashley Kelley
PLUS
Ashley Kelley
Courses Plus Student 10,554 Points

Also, I forgot to mention, try adding 3 lines under the alignment field in the attributes inspector, this will allow your text to readjust onto the next line and fill up the area of the crystal ball (text box).

thanks for your help! Turns out I had the "text:" option set to "attributed" instead of "plain" (what's the difference btw, and why does it only apply the color to the first item if I choose attributed?)

Also, yea I know to go to hardware and say rotate left, but i wish i didn't have to do that every time. I was looking for a default/preference setting but never could find it. In regards to the simulator, the image is actually not adjusting to fit the horizontal view, just the vertical view. Do you know how to make it so that it positions itself accordingly to the horizontal view also?

Thanks again!