With this
NSSortDescriptor *lessonDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lesson" ascending:YES];
[resultArray sortUsingDescriptors:[NSArray arrayWithObject:lessonDescriptor]];
it's sorting the "lesson"-objects to
(
{
lesson = 9;
subject = bg;
},
{
lesson = 8;
subject = bg;
},
{
lesson = 11;
subject = CAE;
},
{
lesson = 11;
subject = CAE;
},
{
lesson = 10;
subject = CAE;
},
{
lesson = 10;
subject = CAE;
},
{
lesson = 5;
subject = Gg;
},
{
lesson = 4;
subject = G;
},
{
lesson = 3;
subject = G;
},
{
lesson = 2;
subject = M;
},
{
lesson = 1;
subject = M;
}
)
as you can see it's not counting correctly.. Can somebody help?
thanks alot
edit:
don't know how to implement the value thing =)
else if ([currentElement isEqualToString:@"lesson"])
{
NSString *trimmedString = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"trimmed: %@",trimmedString);
int value = [trimmedString intValue]; ??
[currentSummary appendString:value]; ??
[currentSummary appendString:trimmedString];
}