The entire day today was dedicated to learning how to set up auto layout. I was particularly determined to figure it all out because I knew iPhone compatibility was something Prof. Medero wants to implement. After finishing Hacking with Swift’s autolayout tutorial which taught me how to get the buttons equally proportioned regardless of orientation or device, I tried extending this to my score label object which displays the current player’s score. It took a while until I got the score to show up in landscape orientation. Then, I tried to figure out how to auto-shrink the text, but all the suggestions I was finding on Stack Overflow wouldn’t make it shrink, be it specific storyboard settings or hardcoding it in. The most progress I got was connecting a button with the score label using the “aspect ratio” constraint, which in theory should cause the score label to shrink proportionate to the button. However, all that happened was that the text box’s height shrunk, but the text was still as big as ever, resulting in large, chopped off text. To future researchers: aspect ratio is for buttons and images, not text.
I finally found this tutorial, which gave me the answers I needed to get text shrinking on my game and in TextScroll. However, I restarted this tutorial a handful of times since instructions were easy to accidentally skip, and it was easy to misaim and connect one object to the wrong one. If it’d be helpful to future TextScroll/Mudd iOS researchers, I could write up a clearer version of this tutorial with many more screenshots and explanations as to precisely what each step does. By the end of the day I got autolayout partially working in TextScroll. I don’t think it’s necessary for the layout to look perfect on every device because I’m sure additional features and UI updates will be added over the next 9 weeks. Long story short, it took me quite a while to figure out how to resize text to look good on every device and orientation, but whenever we finalize the UI, I now know how to get autolayout set up much more quickly than I did today :).