Basically, I wanted the text from the UIAlertController and use that to filter my table view.
I've just tried to do if-statement, but to no avail. I did the filtering at cellForRowAt:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "GPAcell", for: indexPath)
// Configure the cell...
if let cell = cell.textLabel{
if (indexPath.section == 0){
let keys = dc.NUS.keys.sorted()
let userGPA = DataController.sharedInstance.userInput
let key = keys[indexPath.row]
let value = dc.NUS[key]
if let valuegpa = value{
if valuegpa.isLessThanOrEqualTo(userGPA) {
cell.text = "\(valuegpa)"
}
else {
cell.text = "no"
}
}
return cell
}
Any suggestions on what I should try to do? Any help is very much appreciated.
Aucun commentaire:
Enregistrer un commentaire