cs193p – Assignment #3 Task #13 & #14

Please note, this blog entry is from a previous course. You might want to check out the current one.

The user should still be able to abandon the game and start over with a fresh group of cards at any time (i.e. re-deal).

… which actually works already … Main topic here is to do not forget to reload the data for the collection view …

The game must work properly (and look good) in both Landscape and Portrait orientations on both the iPhone 4 and the iPhone 5. Use Autolayout to make this work (not struts and springs).

… its recommend to watch lecture #8 before solving this task.

Start by enabling “Use Autolayout” in storyboard. Depending on what your layout has looked before, this might do some strange magic … e.g. here the collection view used up the complete space and the buttons and labels were not visible any more in landscape mode …

For the card-matching-game view controller start with the deal button and arrange it to have two default constraints to bottom and the right of the super view. The score label should have default constraints to the bottom and the left of the super view, the flips label a default bottom constraint to the super view and a default leading space constraint to the score label. Align the history label with the top of the deal button and increase its size to fill the complete width up to the button. Increase the horizontal-content-hugging priority of the deal button so that that the history label is stretched if necessary/possible. The history slide is placed above, stretching the complete width, with default constrains to the left and right of the super view and do the top of the deal button. Finally change the size of the collection view to snap to the top of the slider.

For the set game snap the deal button to the bottom right corner. On its left side snap the +3 button. Snap the score label to the bottom left, and the status label above. Increase the size of the status label to snap to the +3 button and increase the horizontal-content-hugging priority of the buttons in order to let the status label grow in landscape mode. Finally snap the lower border of the collection view to the top of the buttons.

For the score view controller arrange the buttons at the bottoms snapping to each other (you could spread them with equal spaces using invisible helper views – which might be a little bit out of scope for this task). Snap the bottom of the text view to the top of the buttons.

The settings view controller should work out of the box …

The complete code is available on github.


Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *