I'm new to objective-c programming. I'm doing an application to manage data from a sqlite database. It's used to check attendance of students.
As I'v implemented the update button which change registration time of a student, I used reloadData method to refresh the tableview. However, it doesn't work properly. It did change the view, but not the right cell.
For example, I tried to change the registration time of student A, the method change that of student B.
I debugged it, the database was updated correctly, so I think it is the method wrong. Can anyone give me a hint on the problem? Any suggestion will be appreciated :)
if ([[self.StartOrEndMatrix.selectedCell title] isEqualToString:@"上课"]) {
changedColumn = 3;
}else if([[self.StartOrEndMatrix.selectedCell title] isEqualToString:@"下课"]){
changedColumn = 4;
}
if ([[self.NameOrNumberMatrix.selectedCell title] isEqualToString:@"按姓名"]) {
Index = 1;
}else if ([[self.NameOrNumberMatrix.selectedCell title] isEqualToString:@"按学号"]){
Index = 0;
}
NSString* whereString = [[NSString alloc] initWithString:[self.RegistraitionTextField stringValue]];
NSString* data = [self presentTime];
[self updateStudentInSqlite:_database table:self.table atChangedColumn:changedColumn withOriginValue:whereString atIndex:Index andNewString:data];
[self updateColumnArrayNamed:self.attributeNameArray[changedColumn] atIndex:changedColumn withValue:data];
[self fullDataToStudentInTable];
[self.InfoTable reloadData];
Aucun commentaire:
Enregistrer un commentaire