im working on application that have search view, the search view contain a tableView with 3 sections - i implement the section manually by
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 3;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if (section == 0){
UITextField *title = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 320, 10)];
[title setBackgroundColor:[UIColor lightGrayColor]];
[title setTextAlignment:UITextAlignmentRight];
[title setFont:[UIFont boldSystemFontOfSize:15]];
[title setText:@"videos"];
return title ;
}
if (section == 1){
UITextField *title = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 320, 10)];
[title setBackgroundColor:[UIColor lightGrayColor]];
[title setTextAlignment:UITextAlignmentRight];
[title setFont:[UIFont boldSystemFontOfSize:15]];
[title setText:@"documents"];
return title ;
}
if (section == 2){
UITextField *title = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 320, 10)];
[title setBackgroundColor:[UIColor lightGrayColor]];
[title setTextAlignment:UITextAlignmentRight];
[title setFont:[UIFont boldSystemFontOfSize:15]];
[title setText:@"questions"];
return title ;
}
}
now, all my data received with XML that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>documents</title>
<item>
<title>how to count the days</title>
<link>some link...</link>
<date>11/09/2007 16:45:00</date>
<SupplierName>roei</SupplierName>
<CategoryName>the omer</CategoryName>
</item>
<item>
<title>research</title>
<link>some link...</link>
<date>16/05/2010 13:41:00</date>
<SupplierName>eran</SupplierName>
<CategoryName>shavoot</CategoryName>
</item>
</channel>
<channel>
<title> video </title>
<item>
<title>the end of holiday</title>
<link>some link...</link>
<date>06/06/2011 08:56:00</date>
<SupplierName>dina</SupplierName>
<CategoryName>shavoot</CategoryName>
</item>
<item>
<title>bible</title>
<link>some link...</link>
<date>24/05/2012 10:00:00</date>
<SupplierName>amir</SupplierName>
<CategoryName>shavoot</CategoryName>
</item>
</channel>
<channel>
<title>questions</title>
<item>
<title>questions for shavvot</title>
<link>some link...</link>
<date>28/10/2008 13:31:00</date>
<SenderName>אלי.ד.</SenderName>
<CategoryName>holidays</CategoryName>
</item>
<item>
<title>Shavoot</title>
<link>some link...</link>
<date>25/05/2008 01:01:00</date>
<SenderName>amir</SenderName>
<CategoryName>holidays</CategoryName>
</item>
</channel>
</rss>
as you can see- i have title with the names of the sections, but how should i determine the correct sections for the cells ? im parsing all the data to one array and then getting it out using dictionary:
NSDictionary *object = [ResultsArrayDisplay objectAtIndex:indexPath.row];
please help me, im after few hours of tries with nothing helpful in the internet so far.