Hi how can I sort my Array in sections by Day , I get the data form my webserver (Json) and parse to NSDictionary then save to NSMutableArray… I understand I need to implement
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- titleForHeaderInSection:
- Row for Section:
NSMutableArray Log
2012-04-26 06:12:51.256 passingdata[91699:fb03] array : (
{
post = {
"CLASS_LEVEL" = "Intro/General";
"CLASS_TYPE" = "Muay Thai";
"DAY_OF_WEEK" = Sunday;
ID = 19;
"ORDER_BY" = 5;
TIME = "1:00pm - 2:30pm";
};
}
{
post = {
"CLASS_LEVEL" = "General/Intermediate/Advanced";
"CLASS_TYPE" = "Muay Thai Spar - Competitive";
"DAY_OF_WEEK" = Friday;
ID = 27;
"ORDER_BY" = 5;
TIME = "6:00pm - 9:00pm";
};
},
{
post = {
"CLASS_LEVEL" = "Fighters/Advanced/Intermediate";
"CLASS_TYPE" = "Fighters Training";
"DAY_OF_WEEK" = Monday;
ID = 1;
"ORDER_BY" = 1;
TIME = "9:30am - 11:00pm";
};
},
I can Display all the Data on my table , but I want to do it by section for each day (mon ,tue , wed.. sun), I have try NSpredicate and NSSet but still not working .
I don’t know how to group items by day and get all the information to implement all the methods.
Any ideas ?? Thanks
You should be using the NSPredicate class.
This is what you should do:
The predicate format should not hardcode the day, but should loop through all days and create arrays with results for each day.