Hi everyone,
I was able to set up my simple table view with one section, Now I am trying to set up a multiple section TableView, but after setting everything up as suggested in a tutorial, only the first row of the first section shows up on the screen. While using debugger, I notice that tableView:cellForRowAtIndexPath: gets called only once, and I haven't the slightest idea why.
Here is the code for my tableView:cellForRowAtIndexPath method
As explanation:
"listaDeItems" is a NSMutable array. It contains to NSDictionary objects with a single key: @"Items". Each @"Items" key points to another NSMutableArray, with one or more objects of type "Descuento" inside. the methods "getAsFinalCalculatedValue and getDescuentoText both return NSString objects. While debugging, I've made sure that all objects are loaded properly, so my error shouldn't be the data model (I hope).
My table data source and delegate is a custom class (I manually implemented both UITableViewDataSource and UITableViewDelegate protocols). Any info on this will be very much appreciated. Thanks in advance.
I was able to set up my simple table view with one section, Now I am trying to set up a multiple section TableView, but after setting everything up as suggested in a tutorial, only the first row of the first section shows up on the screen. While using debugger, I notice that tableView:cellForRowAtIndexPath: gets called only once, and I haven't the slightest idea why.
Here is the code for my tableView:cellForRowAtIndexPath method
Code:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:MyIdentifier] autorelease];
}
NSDictionary *dict = [listaDeItems objectAtIndex:indexPath.section];
NSMutableArray *ar = [dict objectForKey:@"Items"];
Descuento *desc = [ar objectAtIndex:indexPath.row];
cell.textLabel.text = [desc getAsFinalCalculatedValue:[salario_bruto floatValue]];
cell.detailTextLabel.text = [desc getDescuentoText];
return cell;
}
As explanation:
"listaDeItems" is a NSMutable array. It contains to NSDictionary objects with a single key: @"Items". Each @"Items" key points to another NSMutableArray, with one or more objects of type "Descuento" inside. the methods "getAsFinalCalculatedValue and getDescuentoText both return NSString objects. While debugging, I've made sure that all objects are loaded properly, so my error shouldn't be the data model (I hope).
My table data source and delegate is a custom class (I manually implemented both UITableViewDataSource and UITableViewDelegate protocols). Any info on this will be very much appreciated. Thanks in advance.