Hello everyone. I have a question about a button that I cannot implement in noteViewController not in storyboard nor in the swift file programmatically. In the noteViewController in storyboard I picked up the bar button but it is not shown when I click + button and in the simulator displays the noteViewController. How to fix this?
Codes are shown below and the photo.
noteViewController:
import UIKit
class noteViewController: UIViewController {
@IBOutlet var Titel: UITextField!
@IBOutlet var texts: UITextView!
public var completion: ((String, String) -> Void)!
override func viewDidLoad() {
super.viewDidLoad()
Titel.becomeFirstResponder()
//how to set a suitable button for saving on storyboard or in the file?
}
@IBAction func saveButton(_ sender: Any) {
}
}
ViewController:
import UIKit
class ViewController: UIViewController {
@IBOutlet var tableView: UITableView!
var models: [(String, String)] = []
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
}
@IBAction func addButton(_ sender: Any) {
let vc = storyboard?.instantiateViewController(identifier: "note") as! noteViewController
vc.modalPresentationStyle = .fullScreen
present(vc, animated: true)
}
}
extension ViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
}
//how to set in func below?
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
return cell
}
}