I want to populate a data in uitableview. I have a different sections with different category and each category contains different number of rows.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
retu allCategory.count;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSString *heading = [allCategory objectAtIndex:section];
retu heading;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
int count = 0;
NSString *heading = [allCategory objectAtIndex:section];
for (Product * cat in productArry) {
if ([cat.category containsString:heading]) {
count ++;
}
}
retu count;
}
This is a code in which I retu a number of rows on a basis of category. For example I have a category name "Engine" which retu one number of row and category name "Blocks" which retu 2 number of rows. Now I want to populate a data against each category in "cellForRowAtIndexPath "method. How can I populate a correct data against each category?
