PDA

View Full Version : Help: Running a method when image is clicked on!




ljh2008
Jan 25, 2009, 03:51 PM
I'm only really just getting started with xCode and interface builder, Im really enjoying it but please can somebody help me with this issue?

In Interface Builder I have created a image well which has a NSImage inside.
When the image is clicked on, i want a method to run.
I have created a method:
- (IBAction)mouseClick: (id)sender;

I set that this method as a 'sent action' of the image well just like I would with a button. Although unlike a button the method does not run when the image is clicked on.

what do I need to do to make it behave in the same way. I have looked thru all the documentation and google searches for hours but cannot figure this out.

Please can someone point me in the right direction



hiddenpremise
Jan 25, 2009, 05:58 PM
Did you connect the NSImageView or the NSImageCell that is inside the well to the IBAction? That might be part of the problem.

ljh2008
Jan 26, 2009, 12:05 PM
When i connect either the Image cell or Image Well to my object the connection appears as a 'sent action. for both ImageCell and ImageWell.

Which should it be?, and why wont it call the method? The method is called of i connect it to a button.

Thanks