top of page

Happy New Year and Welcome Back...


Let's review and create a birthday view, @IBOutlet, @IBAction, more classes and objects...

//

// ViewController.swift

// BD-With-Nat-Meg

//

// Created by Hao Tran on 2/21/18.

// Copyright © 2018 RollingCoders. All rights reserved.

//

import UIKit

class AddBirthdayViewController: UIViewController {

@IBOutlet var firstNameTextField: UITextField!

@IBOutlet var lastNameTextField: UITextField!

@IBOutlet var birthdatePicker: UIDatePicker!

override func viewDidLoad() {

super.viewDidLoad()

// Do any additional setup after loading the view, typically from a nib.

birthdatePicker.maximumDate = Date()

}

@IBAction func saveTapped(sender: UIBarButtonItem) {

//print("The save button was tapped")

let firstName = firstNameTextField.text ?? ""

let lastName = lastNameTextField.text ?? ""

let birthdate = birthdatePicker.date

// print("My name is \(firstName) \(lastName) and my birthdate is \(birthdate).")

let newBirthday = Birthday(firstName: firstName, lastName: lastName, birthdate: birthdate)

print("Created a Birthday!")

print("First name: \(newBirthday.firstName)")

print("Last name: \(newBirthday.lastName)")

print("Birthdate: \(newBirthday.birthdate)")

}

@IBAction func cancelTapped(sender: UIBarButtonItem) {

print("The Cancel button was tapped")

}

}


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page