-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.swift
More file actions
50 lines (37 loc) · 1.12 KB
/
ViewController.swift
File metadata and controls
50 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// ViewController.swift
// Memorizer
//
// Created by Ryan Tsang on 2019-08-25.
// Copyright © 2019 Ryan Tsang. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var userInputBox: UITextField!
@IBOutlet weak var textView: UITextView!
@IBAction func secondStageButton(_ sender: Any)
{
if userInputBox.text != ""
{
performSegue(withIdentifier: "toSecondStage", sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
let secondController = segue.destination as! SecondStageViewController
secondController.userText = userInputBox.text!
}
override func viewDidLoad() {
super.viewDidLoad()
userInputBox.delegate = self
}
@IBAction func displayTextButton(_ sender: Any) {
textView.text = userInputBox.text!
}
}
extension ViewController : UITextFieldDelegate{
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
}