So, I'm trying to create a single on-screen application, where I start with the UIViewController. In addition, there is a UITextfield, button, and UITableView.
Essentially, the intended functionality of the application is that the user enters a word into a UITextField, clicks a button, and displays it on a UITableView.
I never had a problem with this when the button adds UITextField entries to the UITableViewController on another screen, but for some reason I am having problems with the UITableView built into the UIViewController ... On my storyboard, I made a UITableView link as a delegate and UIViewController data source, so this should not be a problem.
Any ideas? My code is published below.
import UIKit var groupList:[String] = [] class ExistingGroups: UIViewController, UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var addGroup: UITextField! @IBAction func addGroupButton(sender: AnyObject) { self.view.endEditing(true) var error = "" if addGroup.text == "" { error = "Please enter a Group!" } else { groupList.append(addGroup.text) } if error != "" { var alert = UIAlertController(title:"Error In Form", message: error, preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title:"OK", style: .Default, handler: { action in self.dismissViewControllerAnimated(true, completion:nil) })) self.presentViewController(alert, animated:true, completion:nil) } addGroup.text = "" } override func viewDidLoad() { super.viewDidLoad()
ios uitableview uiviewcontroller swift
CL8989
source share