Code Monkey home page Code Monkey logo

ios-planets-objc's Introduction

Planets Obj-C

Introduction

The goal of this project is to revisit and remake the Planets project that you've seen before, this time using Objective-C.

Instructions

Please fork and clone this repository, then create an Xcode project in it. Commit regularly as you complete the requirements in this project.

Add the planets from the Planets folder to your Asset Catalog.

Part 1 - Storyboard

When adding new files, remember to give them a prefix!

  1. In the "Main.storyboard", add a navigation controller. Set it to be your initial view controller.
  2. Add a collection view controller scene and create an embed segue from the navigation controller to it. Create a Cocoa Touch file for the collection view controller (with your prefix) called PlanetsCollectionViewController.
  3. The collection view cell should have an image view to show the planet, and a label to show the name of the planet. Create a Cocoa Touch file for the cell and create any outlets and actions you may need.
  4. Add a bar button item to the navigation item of the collection view controller. Set its title to "Settings".
  5. Add a UIViewController scene, then add the following to it:
    • A UIButton titled "Done". Constrain it to the top-right of the view controller.
    • A UILabel with the text "Is Pluto a planet?"
    • A UISwitch that will toggle whether the user wants Pluto to be counted as a planet or not.
  6. Create a Cocoa Touch Subclass for this view controller. Call it SettingsViewController (again, with your prefix), then create any outlets and/or actions you may need.
  7. Create a modally presented segue from the "Settings" button in the collection view controller scene to the SettingsViewController scene.

Part 2 - Model/Model Controller

  1. Create a model object that represents a planet. It should include the name and image of the planet.
  2. Create a model controller that has private hardcoded array of planets
  3. Create a computed property (aka a property in Objective-C) for the planets that adds Pluto if the NSUserDefault property is set.

Part 3 - View Controller

  1. In the SettingsViewController, implement the ability to save whether the user would like to show Pluto using NSUserDefaults.
  2. Implement the required UICollectionViewDataSource methods in the PlanetsCollectionViewController.

Make sure that the collection view updates showing Pluto or not according to the value saved in NSUserDefaults from the switch in the SettingsViewController.

Go Further

  1. Set the collection view to scroll horizontally, and have the size of the cells be scaled in proportion to the other planet cells. E.g. Jupter is the largest so its cell would be the largest, while the Mercury cell would be the smallest. This page includes the size of each planet.

ios-planets-objc's People

Contributors

skysuzuki avatar paulsolt avatar spencercurtis avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.