Uitableview not able to hold data
Posted
by pankaj
on Stack Overflow
See other posts from Stack Overflow
or by pankaj
Published on 2010-06-07T09:55:29Z
Indexed on
2010/06/07
10:22 UTC
Read the original article
Hit count: 175
iphone
Hi i have a uitableview, i am displaying some data of about 200 rows in it. Data will be displayed in several sections which will be determined at run time. I am able to get sections but i am not able to display data for a particular section in correct order. I have data in the form of dictionaries in an array.
My Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
TeraGoAppDelegate *appDel = (TeraGoAppDelegate *)[[UIApplication sharedApplication] delegate];
UITableViewCell *cell = nil;
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
cell.textLabel.text = [(NSMutableDictionary *)[appDel.arrEqp objectAtIndex:countEqpIndex] objectForKey:@"EQP_NAME"];
cell.textLabel.font = [UIFont fontWithName:@"Arial" size:14];
if(![[(NSMutableDictionary *)[appDel.arrEqp objectAtIndex:indexPath.row] objectForKey:@"select"] isEqualToString:@"0"])
{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
cell.accessoryType = UITableViewCellAccessoryNone;
}
// Set up the cell...
return cell;
}
I am trying to use indexPath.row but its values initialises from 0 in every section I can not get data from array in this case as i dont have index of array to get data. How will i get the index of array whose values i need to display????
© Stack Overflow or respective owner