Ich versuche, Informationen aus einer ausgewählten UITableviewCell
Schülerzelle zu einem View-Controller mit einem UITextField
für jeden Teil der Informationen (Vorname, Nachname, etc) so zu pushen geändert, aber ich kann nicht finden, wie diese Informationen aus dem Wörterbuch in jedes Textfeld zu schieben. Ich habe versucht, es ohne Glück neu zuzuweisen.Pushing Informationen aus dem Wörterbuch zu UITextField (Swift)
Hier ist meine eine Probe meiner Wörterbuch schnellen Datei
class ClassRosterModel {
//Student Dictionary for Student infomation
var studentsRoster = [Dictionary<String, String>]()
init() {
studentsRoster.append(["firstName": "Alex" , "lastName" : "Kaz", "major" : "SE", "email" : "[email protected]", "currentTerm" : "Spring", "numberOfCredits" : "\(randomCredits[0])", "password" : "000000"])
}
Und hier ein Teil meiner Klasse, die alle Zellen, bevor sie mit dem Segue
class ClassRosterTableViewController: UITableViewController {
//declaring studentsList dictionary
var studentsList = [Dictionary<String, String>]()
var selectedRowIndex = 0
//Assignment of studentsList and myStudentRoster
let myStudentRoster = ClassRosterModel()
studentsList = myStudentRoster.studentsRoster
//declaring cell with identifier from studentCell.
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("studentCell", forIndexPath: indexPath)
// Configuring the cell with student information
cell.textLabel?.text = "\(studentsList[indexPath.row]["lastName"]!), \(studentsList[indexPath.row]["firstName"]!) - \(studentsList[indexPath.row]["email"]!)"
cell.detailTextLabel?.text = "\(studentsList[indexPath.row]["currentTerm"]!) - \(studentsList[indexPath.row]["numberOfCredits"]!) credits"
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let dvc = segue.destinationViewController as! StudentInfoViewController
let selectedStudent = studentsList[selectedRowIndex]
dvc.studentRecord = selectedStudent
}
Und ich Auswahl hat gerade gemacht das Textfeld für den Vornamen in Student Infoseite
class StudentInfoViewController: UIViewController {
@IBOutlet weak var FirstNameTextField: UITextField!
var studentRecord = Dictionary<String, String>()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}