I have searched the internet countless times and have not found a solution to my situation. Things that may be a solution are things I didn\'t understand and they were in Ob
To collect data from your cells after the user has finished entering the data (score and level), you can use the UITableView
delegate method tableView:didDeselectRowAtIndexPath
[Deselect]
The code in your instance will go in UITableViewController
class and will look something like this.
override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
let cell = tableView.cellForRowAtIndexPath(indexPath) as YourCustomCellClass
var levelArray:[String] = [] //Assuming you want to collect and store your cell data in an Array. You may use a Dictionary as well, whichever is more convenient.
var scoreArray:[String] = []
// levelArray.append(cell.levelLabel.text!)
// scoreArray.append(cell.scoreLabel.text!)
levelArray.insert(cell.levelLabel.text!, atIndex: indexPath.row)
scoreArray.insert(cell.scoreLabel.text!, atIndex: indexPath.row)
}
Next, in you submit button's action(Selector) function use the 'levelArray' and 'scoreArray' to pass your collected data. Be sure to declare the array/dictionary variables(ex: levelArray) right under your UITableViewController
class declaration, like so
class GpaCalculator: UITableViewController {
var levelArray:[String] = []
var scoreArray:[String] = []
override func viewDidLoad() {
super.viewDidLoad()
}
// ...
}
..to be able to use it in other functions like your submit button's action(Selector) function.