hi i am using an NSTableView it contains 2 columns A and B
A contains data B contains buttons
i want when user clicks on an any button inside the table view then its image must get changed.
How i add a custom button inside tableview cell:
NSButtonCell *buttonCell = [[[NSButtonCell alloc] init] autorelease];
[buttonCell setBordered:NO];
[buttonCell setImagePosition:NSImageOnly];
[buttonCell setButtonType:NSMomentaryChangeButton];
[buttonCell setImage:[NSImage imageNamed:@"uncheck.png"]];
[buttonCell setSelectable:TRUE];
[buttonCell setTarget:self];
[buttonCell setAction:@selector(deleteSongContent:)];
[[myTable tableColumnWithIdentifier:@"EditIdentifier"] setDataCell:buttonCell];
When i click on the button the selector method gets fired but i dont understand how to change the image of button cell.
Any suggestions please!!!!!!!
Edit:
When i click on the button the method is called and how it works:
-(void)selectButtonsForDeletion:(NSTableView *)tableView
{
NSEvent *currentEvent = [[tableView window] currentEvent];
int columnIndex = [tableView columnAtPoint:
[tableView convertPoint:
[currentEvent locationInWindow] fromView:nil]];
NSTableColumn *column = [[tableView tableColumns]objectAtIndex:columnIndex];
NSButtonCell *aCell = [[tableView tableColumnWithIdentifier:
[column identifier]]
dataCellForRow:[tableView selectedRow]];
NSInteger index = [[aCell title] intValue];
if(![selectedIndexesArray containsObject:[NSNumber numberWithInt:index]])
{
[aCell setImage:[NSImage imageNamed:@"check.png"]];
[selectedIndexesArray addObject:[NSNumber numberWithInt:index]];
}
else
{
[aCell setImage:[NSImage imageNamed:@"uncheck.png"]];
[selectedIndexesArray removeObjectAtIndex:[selectedIndexesArray indexOfObject:[NSNumber numberWithInt:index]]];
}
}
- (id)initImageCell:(NSImage *)anImage- dianovich