Greetings Program!
stuart little
I've attempted to add right to the cell using addSubview: but it puts the image in multiple places.
This sound like what happens when the cell is reused.
Using the GettingStarted sample app, I did the following which works for me:
- (void)shinobiDataGrid:(ShinobiDataGrid *)grid prepareCellForDisplay:(SDataGridCell *)cell
{
// You will have set the tag (further down) and we will check for the existence of the
// image view in the cell and remove it before configuring the cell.
UIImageView *image = (UIImageView *)[cell viewWithTag:99];
if (image != nil) [image removeFromSuperview];
// If you really wanted to, you could throw it in an if statement and only
// remove it if it's not in the same column.
// if (![cell.coordinate.column.title isEqualToString:@"Name"]) { [above code] }
[code removed]
// determine which column this cell belongs to
if ([cell.coordinate.column.title isEqualToString:@"Name"])
{
UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"graphic1.png"]];
image.frame = CGRectMake(0.0, 0.0, 50.0, 50.0);
image.tag = 99; // Don't forget to give it a tag number.
[cell addSubview:image];
// render the name in the 'name' column
textCell.textField.text = person.forename;
}
[code removed]
}
Wg