Hello All,
I am new to MAC development. I have a situation where I am displaying a number of records in NSTableView (without binding). I have a NSImageCell as one of the cells. Now what I want is that whenever user clicks on NSImageCell then the image should get changed on that particular cell.
Hello All,
I am new to MAC development. I have a situation where I am displaying a number of records in NSTableView (without binding). I have a NSImageCell as one of the cells. Now what I want is that whenever user clicks on NSImageCell then the image should get changed on that particular cell.
Any ideas how should I go about doing this?
Appreciatively,
Mubashir
Hi,
NSImageCell is subclass of NSCell. So please read the class reference for NSCell and check for Managing the Target and Action section.
NSImageCell is subclass of NSCell. So please read the class reference for NSCell and check for Managing the Target and Action section.
Hope you are aware of target/action mechanism.
Thanks for the reply.
I have seen the documentation and here is what I come up with
On my (void)awakeFromNib I have put the following
Code:
[imgCell setAction:@selector(cellClck:)];
Where imgCell is NSCell and cellClck is the target
Code:
-(IBAction)cellClck:(id)sender
{
///My Code here
}
But now I am getting exception "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Stub implementation of -setAction by NSCell does nothing."
Thanks for the reply.
I have seen the documentation and here is what I come up with
On my (void)awakeFromNib I have put the following
Code:
[imgCell setAction:@selector(cellClck:)];
Where imgCell is NSCell and cellClck is the target
Code:
-(IBAction)cellClck:(id)sender
{
///My Code here
}
But now I am getting exception "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Stub implementation of -setAction by NSCell does nothing."
Any ideas?
Appreciatively,
Mubashir
Well, actually the code seems to be half done. You will have to specify the target parameter also.