NSArray* studentsArray = [NSArray arrayWithObjects: student1, student2, student3, student4, student5,student6,student7, student8,student9,student10,nil];
studentsArray = [studentsArray sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
if ([obj1 surname] == [obj2 surname]) {
return [[obj1 name] compare:[obj2 name]];
}else{
return [[obj1 surname] compare:[obj2 surname]];
}
}];