I’ve got a strange problem here.
I have a class that I’ll call MainView. In MainView I have one NSImageView, which I’ll call imageView. I’ve hooked this up to an image view through Interface Builder. I’ve also initialized an instance of MainView in Interface Builder, and have connected an outlet to that instance to another class with an ivar name of mainView. So then, I access the image view like this:
[mainView imageView]
So then, for a test I NSLog‘d the imageView and it returned the address of the objet. So far so good.
Here’s the problem: now I’m trying to get the origin of that imageView by doing this:
NSPoint point = [[mainView imageView] frame].origin;
This should work, right? I’m getting an EXC_BAD_ACCESS (also got a SIGABRT once) warning here with the error in console of: -[NSImage frame]: unrecognized selector sent to instance 0x1001d5fd0
The strange part is that this always used work just fine, but I changed some ivar names and it seemed to mess up the whole thing. I almost know for certain it’s not a hookup issue with IB because I get a memory address when I log the object. Any ideas?
The error message
means that
imageViewis pointing to anNSImageobject instead of anNSImageViewobject. It looks like somewhere in your code you’re reassigning theimageViewoutlet, making it point to anNSImageinstance.