Game of Life, Part 1
Step one: Storyboard
- Create a new Xcode app from scratch, iOS Single View Application, Swift.
- In the project settings, uncheck the landscape orientations so the app will work only in portrait mode.
- On the storyboard, add a UIView (View).
- Give it 1:1 aspect ratio
- Give it a background color so you can see where it is
- Add a caption above the square UIView that says Game of Life or something appropriate.
- Below the UIView, put 6 buttons in a row that say: Clear, Start, Stop, Step, +, and –.
- Put the 6 buttons into a Stack View.
- Put the buttons, the UIView, and the caption into a Stack View.
- Add constraints to the main stack view, using the I-beam tool, to keep it 8 px away from the right and left edges of the screen.
Step two: Code
- Add a new file:
- Cocoa Touch Class,
- Derived from UIView,
- call it CellView. Be careful of upper and lower case letters here.
- Attach the new CellView class to the UIView on the storyboard.
Step three: figure out how to draw a grid.
No comments:
Post a Comment