Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dateStamp = Date()
- var clientName = [""]
- var projecDescript = [""]
- // Custom cell to make all input fields custom
- class CustomCell: UITableViewCell {
- //Make your outlets here, connect the outlets from cell in your storyboard
- @IBOutlet var clientNameLabel: UILabel!
- @IBOutlet var descriptionLabel: UILabel!
- @IBOutlet var dateStamp: UILabel!
- }
- class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
- @IBOutlet var clientTableList: UITableView!
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return (clientName.count)
- return (projecDescript.count)
- }
- // This is the new items added into the inputs
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
- {
- let cell = tableView.dequeueReusableCell(withIdentifier: "clientCell", for: indexPath) as! CustomCell
- // Adds Clients Name
- let companyName = clientName[indexPath.row]
- cell.clientNameLabel?.text = companyName
- // Adds Clients Description
- let descriptionName = projecDescript[indexPath.row]
- cell.descriptionLabel?.text = descriptionName
- return cell
- }
- func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
- return true
- }
- override func viewDidAppear(_ animated: Bool) {
- clientTableList.reloadData()
- }
- import UIKit
- class AddInvoice: UIViewController {
- @IBOutlet var clientNameInput: UITextField!
- @IBOutlet var descriptionNameInput: UITextView!
- @IBAction func addInvoice(_ sender: Any) {
- if clientNameInput.text != "" && descriptionNameInput.text != ""
- {
- clientName.append(clientNameInput.text!)
- //clientInput.text = ""
- projecDescript.append(descriptionNameInput.text!)
- //descriptionFieldInput.text = ""
- _ = navigationController?.popViewController(animated: true)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement