Giter Site home page Giter Site logo

favoritethings's Introduction

FavoriteThings

A simple iOS app that displays a list of favorite things in a table view.

Step 1: Add a view controller in a navigation controller to the app

  • Create a UIViewController called FavoriteThingsViewController
  • In the AppDelegate didFinishLaunching method initialize a UINavigationController with a scoreViewController instance as the rootViewController
  • Make the navigationController the rootViewController of the window.

Test Step 2: Add a button that changes text

Note: This is just for the test. We're going to delete this code once we're done

  • Add a UIButton and UILabel as properties on the new viewcontroller class
  • Initialize and put the button and label on the screen
  • Set the button's title to "Press me" for control state normal
  • Set the label's text to "Change me"
  • Add a function that changes the label's text to "Thanks for changing me"
  • Add self as target to the button with the new method as the selector

Step 3: Clean up the view controller

  • Remove the button and label from the view

Step 4: Add a tableview to the view

  • Add a UITableView as a property on the viewController class
  • Initialize and add the tableView as a subview of the main view

Step 5: Create a new tableViewDatasource

  • Create a NSObject subclass called FavoriteThingsTableViewDataSource
  • In the header file, adopt the UITableViewDataSource protocol
  • Add the required UITableViewDataSource methods to the implementation file
  • Write a method that returns an array of strings (these can be your favorite things)
  • In numberOfRows return the count of your array method
  • in cellForRowAtIndexPath return a cell with the textLabel.text set to the string at indexPath.row from the array method

favoritethings's People

Contributors

christianmonson avatar jkhowland avatar

Watchers

 avatar  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.