top of page

Let's Add Life to the Buttons

  • Feb 2, 2018
  • 1 min read

// 1. change name here

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 ?? ""

// print("My name is \(firstName) \(lastName)")

//

let birthdate = birthdatePicker.date

// print("My birthday 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) {

dismiss(animated: true, completion: nil)

}

}

// viewDidLoad - Swift expects everyone to use this method (Swift call one tme)

// viewWillAppear - call before each time view controller view appears on the screen

// viewWillDisappear - call when the view controller about to leave the screen

//


 
 
 

Comments


Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Follow us - coming soon...

© 2017 by RollingCoders Kids
 

Call

T: (408) 656-9623

  • Facebook Clean
  • Twitter Clean
  • White Google+ Icon
bottom of page