annareedsmalley / Tips

Prework for Codepath: iOS for Designers and Product Managers
0 stars 0 forks source link

Tips Prework #1

Open annareedsmalley opened 9 years ago

annareedsmalley commented 9 years ago

tipsfinal

annareedsmalley commented 9 years ago

@codepathreview, see animated gif above.

annareedsmalley commented 9 years ago

Here's my code - not sure what else to do with it but paste it here:

// // ViewController.swift // tips // // Created by Anna Smalley on 9/27/15. // Copyright © 2015 Anna Smalley. All rights reserved. //

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var tipControl: UISegmentedControl!
@IBOutlet weak var billField: UITextField!
@IBOutlet weak var totalLabel: UILabel!
@IBOutlet weak var tipLabel: UILabel!
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    tipLabel.text = "$0.00"
    totalLabel.text = "$0.00"
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func OnEditingChanged(sender: AnyObject) {

    var tipPercentages = [0.18, 0.2, 0.25]
    var tipPercentage = tipPercentages[tipControl.selectedSegmentIndex]

    var billAmount = NSString(string: billField.text!).doubleValue
    var tip = billAmount * tipPercentage
    var total = billAmount + tip

    tipLabel.text = "$\(tip)"
    totalLabel.text = "$\(total)"

    tipLabel.text = String(format: "$%.2f", tip)
    totalLabel.text = String(format: "$%.2f", total)

}

@IBAction func onTap(sender: AnyObject) {

    view.endEditing (true)
}

}

timothy1ee commented 9 years ago

Good work. This prework is a preview of our weekly project process. Generally, weekly projects take between 5-10 hours to complete the required features and an additional 5-10 hours to complete the optional features. In general, we've seen that the more hours you log, the quicker you improve your proficiency with iOS.

In order to prepare for the design class, you should start thinking about app ideas that you're interested in building and create paper or digital wireframes. Note that the prototyping techniques that we'll be teaching are well suited for fun/social/productivity apps like Yahoo, Facebook, Dropbox, Airbnb, etc.