I have 2 arrays of information that I’m loading in to an UITableView control through the following:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
if(indexPath.section == 0)
cell.textLabel.text = [arryTableData objectAtIndex:indexPath.row];
else
cell.textLabel.text = [arryTableActions objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}
I want the top array (arryTableData) which is below this to have as the first cell an image of the location.
arryTableData = [[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"%@", locName],
[NSString stringWithFormat:@"%@", locPhone],
@"Address Info",
@"Access Icons",
nil];
So just before locName I’d like locImage to be in there. How do I load an image in to the array and then display it in the cell?
Thanks
Tom
I would recommend NOT to load a UIImage into a NSArray.
Just add the “ImageName” (filename) into the NSArray as NSString.
When you need to show your image, do this:
You need to load NSString into the NSArray arryTableImage.
Okay four you?